0

我想使用smoothdivscroll(http://smoothdivscroll.com/index.html )作为用户可以使用http://sachinchoolur.github.io/lightGallery/index.html灯箱打开的图像滚动块。不幸的是,这些脚本在使用相同的选择器时不起作用。

<script type="text/javascript">

 if (Modernizr.touch) {   
    $(".scroll-banner").smoothDivScroll({ 
        hotSpotScrolling: false,
        touchScrolling: true,
        manualContinuousScrolling: true,
        mousewheelScrolling: false
    });
} else {   
$(".scroll-banner").smoothDivScroll({ 
        mousewheelScrolling: "horizontal",
        mousewheelScrollingStep: -1,
        easingAfterMouseWheelScrollingFunction: "easeOutCirc",
        manualContinuousScrolling: true,
        autoScrollingMode: "onStart",
        scrollingHotSpotLeftClass: "prev",
        scrollingHotSpotLeftVisibleClass: "prevVisible",
        scrollingHotSpotRightClass: "next",
        scrollingHotSpotRightVisibleClass: "nextVisible",
});
}
$(function() {
$(".scroll-banner").lightGallery({
      loop:true,
      auto:false,
      pause:1000,
      counter:true,
      vimeoColor: "000000"
    });
});
</script>

如何让两个插件使用相同的选择器?

4

1 回答 1

0

是否可以这样使用它:

$(document).ready(function() {
    var scrollbanner = $(".scroll-banner");
    scrollbanner.smoothDivScroll({ 
        mousewheelScrolling: "horizontal",
        mousewheelScrollingStep: -1,
        easingAfterMouseWheelScrollingFunction: "easeOutCirc",
        manualContinuousScrolling: true,
        autoScrollingMode: "onStart",
        scrollingHotSpotLeftClass: "prev",
        scrollingHotSpotLeftVisibleClass: "prevVisible",
        scrollingHotSpotRightClass: "next",
        scrollingHotSpotRightVisibleClass: "nextVisible",
    });

    scrollbanner.lightGallery({
        loop:true,
        auto:false,
        pause:1000,
        counter:true,
        vimeoColor: "000000"
    });
});

在您的代码中,当 DOM 准备好而另一个函数未准备好时,将调用其中一个函数。更改执行顺序以将功能添加到 div 时,行为/错误是否会发生变化?

于 2014-08-09T23:55:58.000 回答