我在新版本中使用bootstrap开发响应式网站。我使用旋转木马到所有屏幕。但是当小屏幕(我试过我的手机)时,旋转木马会动摇我的内容。这意味着,在幻灯片1 =>之后2,我所有的内容都会震动但是在正常使用桌面设备的时候。这是我的代码:
<div id="carousel" class="carousel slide carousel-fade">
<ol class="carousel-indicators">
<li data-target="#carousel" data-slide-to="0" class="active"></li>
<li data-target="#carousel" data-slide-to="1"></li>
<li data-target="#carousel" data-slide-to="2"></li>
</ol>
<div class="carousel-inner">
<div class="active item"><img src="img1.jpg"></div>
<div class="item"><img src="img2.jpg"></div>
<div class="item"><img src="img3.jpg"></div>
</div>
</div>
和javascript
<script>
$(document).ready(function(){
$('.carousel').carousel({
interval: 4000
});
});
</script>
最后:Css
.carousel-fade .carousel-inner .active {
opacity: 1;
}
.carousel-fade .carousel-inner .active.left,
.carousel-fade .carousel-inner .active.right {
left: 0;
opacity: 0;
z-index: 1;
}
.carousel-fade .carousel-inner .next.left,
.carousel-fade .carousel-inner .prev.right {
opacity: 1;
}
.carousel-fade .carousel-control {
z-index: 2;
}
html,
body,
.carousel,
.carousel-inner,
.carousel-inner .item {
height: 100%;
margin-top:0px;
}