且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

设置后更改owl carousel 2选项?

更新时间:2023-11-26 13:57:52

不要试图通过挂钩拖动事件来禁用拖动,***使用 owl.reinit ()函数,以及 touchDrag mouseDrag 选项。例如,如果你有一个轮播 #carousel

Rather than try to disable the drag via hooking into the drag events, it would be better to use the owl.reinit() function, along with the touchDrag and mouseDrag options. For instance, if you had a carousel #carousel:

var $carousel = $('#carousel');
var owl = $carousel.data('owlCarousel'); # Your DOM element gets an 'owlCarousel' data property containing the Owl object. 
owl.reinit({touchDrag: false, mouseDrag: false;});

虽然该方法名为 reinit ,但它不会删除任何先前设置的选项。

Although the method is named reinit, it won't blank any of your previously-set options.