jQuery - Owl Carousel - 如何将元素放置在一个不会让它滑动的猫头鹰项目中?

时间:2014-03-21 23:30:00

标签: javascript jquery swipe jgestures

我正在制作一个使用Owl Carousel的Javascript应用程序。 在一个项目中,我放置了一个听取jgestures手势的div。 我正在听的手势是滑动手势。但是当我在div上滑动时,Owl Carousel也会滑动到下一个/上一个项目。

这是我的jgesture代码

function(event_, obj) {
    // ignore bubbled handlers
    // if ( obj.originalEvent.currentTarget !== obj.originalEvent.target ) {
    // return; }
    obj.originalEvent.preventDefault();
    obj.originalEvent.stopPropagation(); //Should stop it from swiping?
}

旋转木马仍在滑动.. 我该怎么办?

1 个答案:

答案 0 :(得分:2)

 ..
 preventParentSwipe:function(event){
    event.preventDefault();
    event.stopPropagation();
 }
 ..
 $("#swipe").on('touchstart.owl mousedown.owl',preventParentSwipe);

swipe是您绑定jgestures的容器。