[英]using same same selector for Query lightGallery + smoothdivscroll,
I would like to use smoothdivscroll ( http://smoothdivscroll.com/index.html ) for a scrolling block of images which users can open using the http://sachinchoolur.github.io/lightGallery/index.html lightbox. 我想使用smoothdivscroll( http://smoothdivscroll.com/index.html )来滚动图像,用户可以使用http://sachinchoolur.github.io/lightGallery/index.html灯箱打开它。 Unfortunately these scripts do not function when using the same selector.
不幸的是,当使用相同的选择器时,这些脚本不起作用。
<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>
How do I get two plugins to use the same selector? 如何让两个插件使用相同的选择器?
is it possible to use it this way: 是否可以通过这种方式使用它:
$(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"
});
});
In your code one of the functions is called when DOM is ready and the other is not. 在您的代码中,当DOM准备就绪时调用其中一个函数,而另一个则未调用。 Does the behaviour/error change when changing the order of execution for adding the functionality to the divs?
更改将功能添加到div的执行顺序时,行为/错误是否会更改?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.