javascript - Disable web page navigation on swipe(back and forward) -


on windows phone, in ie users can go , forward swiping on screen if swipe coming edge. os level functionality hampering webpage's ux.

is there js or css can disable that? hack do.

a snapshot windowsphone's website: enter image description here

here link reference page: http://www.windowsphone.com/en-in/how-to/wp8/basics/gestures-swipe-pan-and-stretch

please note still need touchaction enabled horizontal scrolling.

copy , paste javascript:

var xpos = null; var ypos = null; window.addeventlistener( "touchmove", function ( event ) {     var touch = event.originalevent.touches[ 0 ];     oldx = xpos;     oldy = ypos;     xpos = touch.pagex;     ypos = touch.pagey;     if ( oldx == null && oldy == null ) {         return false;     }     else {         if ( math.abs( oldx-xpos ) > math.abs( oldy-ypos ) ) {             event.preventdefault();             return false;         }     } } ); 

if want minified, copy , paste this:

var xpos=null;var ypos=null;window.addeventlistener("touchmove",function(event){var touch=event.originalevent.touches[0];oldx=xpos;oldy=ypos;xpos=touch.pagex;ypos=touch.pagey;if(oldx==null && oldy==null){return false;}else{if(math.abs(oldx-xpos)>math.abs(oldy-ypos)){event.preventdefault();return false;}}});


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -