jquery mobile multiple event firing on swipeleft and swiperight events.
I have been developing a mobile website using jQuery mobile.
This website have a carousel slide show, which should work with swipe left and swipe right events.
Interestingly, I found that, swipeleft and swiperight events are triggering multiple times. And this results in an unpredicted behaviors on the carousel slide show.To prevent the this multiple event firing, I used the jQuery method stopImmediatePropagation();
My final code looks like
1 2 3 4 5 6 7 8 9 10 |
$("#slides ul").live({ swipeleft: function(event){ slide.next(); event.stopImmediatePropagation(); }, swiperight: function(event){ slide.prev(); event.stopImmediatePropagation(); } }); |
One comment
tej
Not working for me I am using swipe to delete for a list in mobile jquery.