Jquery动画cloud9轮播添加活动类

时间:2016-09-20 06:58:01

标签: jquery animation cloud9

我在这里使用http://specious.github.io/cloud9carousel/滑块,  当图像在侧面旋转时,我想添加活动类。

2 个答案:

答案 0 :(得分:1)

由于受欢迎的需求,从版本2.2.0开始,通过frontItemClass属性automatically tags提供您选择的类名称:

var carousel = $("#carousel")

carousel.Cloud9Carousel({
  // ...
  frontItemClass: "active"
})

在JS Bin上直播demo

答案 1 :(得分:0)

你可以添加“onRendered”回调函数 我用它并为我工作

var showcase = $("#showcase")
var card = $("#showcase .card")
showcase.Cloud9Carousel( {
        yOrigin: 42,
        yRadius: 40,
        itemClass: "card",
        buttonLeft: $(".nav2.prev"),
        buttonRight: $(".nav2.next"),
        bringToFront: true,
        onRendered: showcaseUpdated,
        onLoaded: function() {
          showcase.css( 'visibility', 'visible' )
          showcase.css( 'display', 'none' )
          showcase.fadeIn( 1500 )
        }
      } )
      function showcaseUpdated( showcase ) {
        $(card).removeClass('active');
        var index = showcase.nearestIndex();
        $(showcase.items[index].element).addClass('active');
      }
相关问题