jquery - Click event not working on iPad with touch event -
i using click event on page link. works on ipad's safari, when use touch events on same page click event stops working; touch event works there on ipad.
click event:
link.onclick = onlinkclick;
touch event:
$('#sdiv').bind({ 'touchstart': function (e) { ontouchstart(e, sdiv); } }); $('#sdiv').bind({ 'touchend': function (e) { ontouchend(e); } }); $('#sdiv').bind({ 'touchmove': function (e) { ontouchmove(e); } }); $('#sdiv').bind({ 'touchcancel': function (e) { ontouchcancel(e); } });
finally, differentiate both platforms, ipad , desktop. using 'navigator.platform', if it's ipad touch event works, else click event.
var platform = navigator.platform; if( platform == 'ipad') { _link.ontouchend = onlinkclick;} else { _link.onclick = onlinkclick; }
thanks all,
Comments
Post a Comment