問題描述
在 Chrome Mobile 上,Google 引入了帶有向左/向右滑動事件的標簽導航.
On Chrome Mobile, Google introduced a tab navigation with the swipe left/right events.
但是我有一個 web 應用程序,并且我實現了向左滑動事件來打開我的導航菜單(如 facebook 或 spotify)
But i have a webapp, and i implement a swipe left event to open my navigation menu (like facebook or spotify)
問題是,如果用戶在第一個左側像素(left:0)上開始滑動,瀏覽器將啟動導航模式,并且不執行我的打開菜單功能.
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.
有沒有辦法在 Chrome 上禁用或停止導航模式?
Is there a way, to disable or stop the navigation mode on Chrome ?
我已經嘗試使用 .preventDefault
和 stopPropagation
功能,但無法正常工作:(
I already tried with .preventDefault
, and stopPropagation
function, but not working :(
感謝您的幫助
推薦答案
您可以嘗試使用以下組合:
Could you try using a combination of:
- 根據 window.onbeforeunload 攔截瀏覽器
Back
函數"nofollow">這個例子,和 - 使用 this示例?
- intercepting the browser
Back
function usingwindow.onbeforeunload
, as per this example, and - disabling navigation using the technique illustrated in this example?
這篇關于在 javascript 中禁用 Chrome 瀏覽器上的導航滑動的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!