I am using jquery mobile beta and jquery 1.6. On ipod touch, a swipe event is also trigerring the tap event. This issue is not hapenning on android devices. I am trying to google out the solution, but looks like there are not many with the same problem. Is there something very basic that I am missing??
$("div.totapandswipe").bind('tap',function(event, ui){
alert('event');
});
$("div.totapandswipe").bind('swipe',function(event, ui){
alert('event');
});
Thank you for the help!
I have found that I needed to unbind('click') as the first option in my bind('swipeleft swiperight') function. Since my swipe goes to a new page, that page re-binds the 'click' event for the page that it just left. My utility is a flashcard that tap brings a new card and swiping flips it over. Good luck.
$('#flashVerse').bind('swipeleft swiperight', function(event) {
console.log(event.type);
$('#flashVerse').unbind('click');
if(event.type == 'swipeleft') {
$.mobile.changePage('flashReference','flip');
} else {
$.mobile.changePage('flashReference','flip',true,false);
console.log('SWIPERIGHT');
}
});
$('#flashReference').live('pageshow',function(event,ui){
if((tipsOn() || ls.getItem('tipFlash') == '1') && ui.prevPage.attr('id')!='flashVerse') {
ls.setItem('tipFlash','0');
var msg = 'Swipe to flip the card.\n Tap for a new card.\nuse Options to turn Tips back on.';
if(phoneGap) navigator.notification.alert(msg,dummy,'Flash Cards','OK');
else alert(msg);
}
$('#lnkFlashVerse').addClass('ui-btn-active').addClass('ui-state-persist');
$('#lnkFlashReference').removeClass('ui-btn-active').removeClass('ui-state-persist');
$('#flashReference').bind('click', function(event) {
console.log(event.type);
newFlashCard();
//$('#flashReference div[data-role="content"]').append('clicked ');
});
});
This seemed to help me:
$("selector").swiperight(function (e) {
if (e.type === "swiperight") {
myHandler(e);
}
});
It's lame that this would be an issue. Jqm bug on this yet?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With