[英]Bootstrap Carousel white space
Everytime a new slide comes into the Carousel, it has a small white space under under it as it slides, when it gets to the resting area in the middle, it quickly shoots down to settle where it should. 每次新的幻灯片进入旋转木马时,它在其下方都会有一个小的白色空间,当它到达中间的休息区时,它会迅速向下射击以固定在应有的位置。 The white space only seems to be about 10-15px, but it happens on every slide.
空格似乎只有10至15像素左右,但每张幻灯片都会出现。
I am using the default Carousel with Bootstrap. 我在Bootstrap中使用默认的Carousel。 This is my code, not sure if it is having an issue here or elsewhere.
这是我的代码,不确定在这里还是其他地方是否有问题。
<div class="row ">
<div class="col-md-12">
<div class="carousel slide" id="theCarousel" data-interval="4000">
<ol class="carousel-indicators">
<li data-target="#theCarousel" data-slide-to="0" class="active"></li>
<li data-target="#theCarousel" data-slide-to="1"></li>
<li data-target="#theCarousel" data-slide-to="2"></li>
<li data-target="#theCarousel" data-slide-to="3"></li>
</ol>
<div class="row">
<div class="carousel-inner">
<div class="item active">
<img src="img/berwick5.jpg" alt="1" class="img-responsive"/>
</div>
<div class="item ">
<img src="img/pic3_e.jpg" alt="2" class="img-responsive"/>
</div>
<div class="item ">
<img src="img/pic1_e.jpg" alt="3" class="img-responsive"/>
</div>
<div class="item ">
<img src="img/pic2_e.jpg" alt="4" class="img-responsive"/>
</div>
</div>
</div>
</div>
</div>
Try defining the height
property, or use overflow
: 尝试定义
height
属性,或使用overflow
:
#theCarousel {
overflow-y: hidden;
}
<div class="container">
<div class="span8">
<div id="theCarousel" class="carousel slide">
<ol class="carousel-indicators">
<li data-target="#theCarousel" data-slide-to="0" class="active"></li>
<li data-target="#theCarousel" data-slide-to="1" class=""></li>
<li data-target="#theCarousel" data-slide-to="2" class=""></li>
<li data-target="#theCarousel" data-slide-to="3" class=""></li>
</ol>
<div class="carousel-inner">
<div class="item active">
<img src="img/berwick5.jpg" alt="1" class="img-responsive"/>
</div>
<div class="item">
<img src="img/pic3_e.jpg" alt="2" class="img-responsive"/>
</div>
<div class="item">
<img src="img/pic1_e.jpg" alt="3" class="img-responsive"/>
</div>
<div class="item ">
<img src="img/pic2_e.jpg" alt="4" class="img-responsive"/>
</div>
</div>
<a class="left carousel-control" href="#theCarousel" data-slide="prev">‹</a>
<a class="right carousel-control" href="#theCarousel" data-slide="next">›</a>
</div>
</div>
</div>
Turns out it was a combination of image sizes (made them all the same size) and the 原来,这是图像尺寸(使它们都具有相同的尺寸)和
margin-top: -.75em;
in the styles.css file. 在styles.css文件中。 Thank you guys.
感谢大伙们。
You may want to try changing the Twitter Bootstrap code .carousel-inner { overflow: hidden; }
您可能想尝试更改Twitter Bootstrap代码
.carousel-inner { overflow: hidden; }
.carousel-inner { overflow: hidden; }
to .carousel-inner { overflow: visible; }
.carousel-inner { overflow: hidden; }
到.carousel-inner { overflow: visible; }
.carousel-inner { overflow: visible; }
. .carousel-inner { overflow: visible; }
。 This got rid of the white space showing during transition on my iPhone. 这消除了我的iPhone过渡期间显示的空白。 For some reason, I only had the problem on my mobile phone, not on my MacBook / laptop screen.
由于某种原因,我只在手机上遇到了问题,而在MacBook /笔记本电脑的屏幕上却没有问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.