Javascript Owl carousel V1 禁用/启用拖动
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/28048230/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Owl carousel V1 disable/enable drag
提问by StealthRT
Hey all I have a quick question regarding the Owl Carousel.
大家好,我有一个关于猫头鹰旋转木马的快速问题。
How can I enable the touchdragwhen I first use this code:
首次使用此代码时如何启用触摸拖动:
var owl = $(".full-slider");
owl.owlCarousel({
slideSpeed : 500,
singleItem : true,
pagination : false,
autoPlay : false,
afterMove : slideChanged,
startDragging : pauseOnDragging,
touchDrag : false,
mouseDrag : false
});
Depending on the options the user uses on my page, I want to disable the ability to drag to the next slide. But if the user completes the options then I would like to enable it back so they can drag to the next slide.
根据用户在我的页面上使用的选项,我想禁用拖动到下一张幻灯片的功能。但是如果用户完成了这些选项,那么我想重新启用它,以便他们可以拖动到下一张幻灯片。
How can this be done? I haven't been able to find a good example online for doing this.
如何才能做到这一点?我一直无法在网上找到一个很好的例子来做到这一点。
回答by StealthRT
I found out how to do it finally:
我终于知道怎么做了:
owl.data('owlCarousel').reinit({
touchDrag : true,
mouseDrag : true
});

