我想在网站上制作一堆js / css动画的幻灯片。我使用bootstrap作为它的框架。 Carousel听起来像幻灯片中幻灯片的内置功能,但看起来像是图像。我是js动画,我发现很难处理它。有没有更好的方法基于bootstrap框架呢?
这是Carousel in bootstrap:
<!-- Carousel - consult the Twitter Bootstrap docs at
http://twitter.github.com/bootstrap/javascript.html#carousel -->
<div id="this-carousel-id" class="carousel slide"><!-- class of slide for animation -->
<div class="carousel-inner">
<div class="item active"><!-- class of active since it's the first item -->
<img src="http://placehold.it/1200x480" alt="" />
<div class="carousel-caption">
<p>Caption text here</p>
</div>
</div>
<div class="item">
<img src="http://placehold.it/1200x480" alt="" />
<div class="carousel-caption">
<p>Caption text here</p>
</div>
</div>
<div class="item">
<img src="http://placehold.it/1200x480" alt="" />
<div class="carousel-caption">
<p>Caption text here</p>
</div>
</div>
<div class="item">
<img src="http://placehold.it/1200x480" alt="" />
<div class="carousel-caption">
<p>Caption text here</p>
</div>
</div>
</div><!-- /.carousel-inner -->
<!-- Next and Previous controls below
href values must reference the id for this carousel -->
<a class="carousel-control left" href="#this-carousel-id" data-slide="prev">‹</a>
<a class="carousel-control right" href="#this-carousel-id" data-slide="next">›</a>
</div><!-- /.carousel -->
我想做的事情却搞砸了:
答案 0 :(得分:0)
您可以使用$('.carousel').carousel();
激活滑块,并在每张幻灯片上使用您的js / css效果
$('.carousel').on('slide.bs.carousel', function () {
// js function etc.
});
例如http://jsbin.com/kekocuha/1,我为每张幻灯片使用动画css制作文字动画,你也可以使用你的图像js等