繁体   English   中英

Twitter引导带js代码的轮播幻灯片

[英]Twitter bootstrap carousel slideshow with js code

我想在站点上制作一堆js ​​/ css动画的幻灯片。 我正在使用引导程序作为其框架。 旋转木马听起来像幻灯片放映中的内置功能,但似乎是用于图像的。 我的是js动画,我发现很难处理它。 有没有更好的方法基于引导框架呢?

这是Bootstrap中的Carousel:

<!--  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">&lsaquo;</a>
    <a class="carousel-control right" href="#this-carousel-id" data-slide="next">&rsaquo;</a>
</div><!-- /.carousel -->

我正在尝试做的却把事情搞砸了:

您可以在$('.carousel').carousel();使用活动滑块$('.carousel').carousel(); 在每张幻灯片上,您都可以将js / css效果与

$('.carousel').on('slide.bs.carousel', function () {
 // js function etc.
});

例如http://jsbin.com/kekocuha/1 ,我为每个幻灯片的文本动画使用了animate css,您也可以使用图像js等。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM