Disable navigation swipe on Chrome browser in javascript [duplicate]

橙三吉。 提交于 2019-12-09 18:27:32

问题


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 using window.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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!