Disable navigation swipe on Chrome browser in javascript(在 javascript 中禁用 Chrome 浏览器上的导航滑动)
问题描述
在 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 浏览器上的导航滑动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在 javascript 中禁用 Chrome 浏览器上的导航滑动


- 如何显示带有换行符的文本标签? 2022-01-01
- 从原点悬停时触发 translateY() 2022-01-01
- 我不能使用 json 使用 react 向我的 web api 发出 Post 请求 2022-01-01
- 是否可以将标志传递给 Gulp 以使其以不同的方式 2022-01-01
- 为什么我的页面无法在 Github 上加载? 2022-01-01
- 在不使用循环的情况下查找数字数组中的一项 2022-01-01
- 使用 iframe URL 的 jQuery UI 对话框 2022-01-01
- 为什么悬停在委托事件处理程序中不起作用? 2022-01-01
- 如何向 ipc 渲染器发送添加回调 2022-01-01
- 如何调试 CSS/Javascript 悬停问题 2022-01-01