Question

I'm making a Javascript application that uses Owl Carousel. In one item i've placed a div that listenes to jgestures gestures. The gestures I am listening to are swipe gestures. But when I swipe on the div, also the Owl Carousel swipes to the next/previous item.

this is my code of the 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?
}

The carousel still swipes.. What can I do?

Was it helpful?

Solution

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

swipe is the container where you bind the jgestures on.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top