【问题标题】:Jquery Animation cloud9 carousel add active classJquery Animation cloud9轮播添加活动类
【发布时间】:2016-09-20 06:58:01
【问题描述】:

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

【问题讨论】:

  • 能否添加您迄今为止尝试过的示例?
  • 我用过这个插件,但是我看不到活动类,所以我想制作 css 哪个图像在前面,

标签: jquery animation cloud9


【解决方案1】:

由于大众需求,从 2.2.0 版开始,通过最前面的 frontItemClass 属性 automatically tags 提供您选择的类名:

var carousel = $("#carousel")

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

JS Bin 直播demo

【讨论】:

    【解决方案2】:

    您可以添加“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');
          }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-05-02
      • 1970-01-01
      • 2014-02-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-12-30
      相关资源
      最近更新 更多