旋转木马不在桌面上显示图像

时间:2016-01-16 10:48:12

标签: jquery html css twitter-bootstrap-3 carousel

我有一个工作正常的旋转木马。但是当我尝试减小旋转木马的高度时,整个图像不会显示在旋转木马中(在桌面上)。在移动设备上它工作正常。

我不希望旋转木马覆盖整个页面。 请全屏查看输出。

示例:

@import url('https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css');
@import url('https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css');
 #carousel-example-generic .carousel-inner .item {
  padding-bottom: 50%;
}
#carousel-example-generic .carousel-inner .first-item {
  height: 100%;
  width: 100%;
  background: url('http://p1.pichost.me/i/13/1359503.jpg');
  background-size: cover;
  background-position: center;
}
#carousel-example-generic .carousel-inner .second-item {
  height: 100%;
  width: 100%;
  background: url('http://all4desktop.com/data_images/1920%20x%201200/4211692-abstract-color-background-picture-8016.jpg');
  background-size: cover;
  background-position: center;
}
#carousel-example-generic .carousel-inner .third-item {
  height: 100%;
  width: 100%;
  background: url('http://www.macwallhd.com/wp-content/Wallpapers/Abstract/Mac%20Wallpaper%20Spin%20The%20Apple%20Circle-575024442.jpeg');
  background-size: cover;
  background-position: center;
}
<script src="http://code.jquery.com/jquery-latest.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>

<div id="carousel-example-generic" class="carousel slide slid" data-ride="carousel">
  <ol class="carousel-indicators">
    <li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
    <li data-target="#carousel-example-generic" data-slide-to="1"></li>
    <li data-target="#carousel-example-generic" data-slide-to="2"></li>
  </ol>
  <div class="carousel-inner" role="listbox">
    <div class="item active first-item">
      <div class="carousel-caption">
        ...
      </div>
    </div>
    <div class="item second-item">
      <div class="carousel-caption">
        ...
      </div>
    </div>
    <div class="item third-item">
      <div class="carousel-caption">
        ...
      </div>
    </div>
  </div>
  <a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev">
    <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
    <span class="sr-only">Previous</span>
  </a>
  <a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next">
    <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
    <span class="sr-only">Next</span>
  </a>
</div>

1 个答案:

答案 0 :(得分:1)

添加以下CSS设置#carousel-example-generic { max-width: 960px; margin: auto; } ,之后它的宽度与高度成比例限制:

var frm = document.getElementById('iframeid'); // id changes on every reload
var doc = frm.contentDocument;
var chat = doc.getElementById(':cb.f'); // this id also changes on every reload

输出:http://output.jsbin.com/revecireyu/1