问题
On Chrome Mobile, Google introduced a tab navigation with the swipe left/right events.
But i have a webapp, and i implement a swipe left event to open my navigation menu (like facebook or spotify)
The problem is, if user start his swipe on the first left pixel (left:0), the browser start the navigation mode, and do not execute my opening menu function.
Is there a way, to disable or stop the navigation mode on Chrome ?
I already tried with .preventDefault
, and stopPropagation
function, but not working :(
Thanks for your help
回答1:
Could you try using a combination of:
- intercepting the browser
Back
function usingwindow.onbeforeunload
, as per this example, and - disabling navigation using the technique illustrated in this example?
回答2:
This behaviour is built into the java source of chrome (probably), which is why I think it won't be possible to disable this behaviour with Javascript alone. Maybe you can distribute you app with phonegap, if this behaviour is necessary.
来源:https://stackoverflow.com/questions/13415370/disable-navigation-swipe-on-chrome-browser-in-javascript