使用鼠标中键滚动按钮禁用浏览器滚动 [英] Disable browser scrolling with the middle mouse scroll button

查看:164
本文介绍了使用鼠标中键滚动按钮禁用浏览器滚动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的页面上有一个Flash元素,您可以使用中间的鼠标滚轮进行交互。页面很长。所以,当用鼠标滚轮滚动时,它会与Flash元素交互,并滚动浏览器窗口。

有没有办法在Flash元素处于活动状态时禁用浏览器滚动? / b>

解决方案

您可以使用

  document.body.style.overflow = allowScroll : 隐藏; 

其中allowScroll是一个布尔值。


I have a flash element on my page that you interact with by using the middle mouse scroll wheel. The page is long. So when scrolling with the mouse wheel it interacts with the Flash element AND scrolls the browser window.

Is there a way to disable browser scrolling while the Flash element is active?

解决方案

You can use:

document.body.style.overflow=allowScroll?"":"hidden";

Where allowScroll is a boolean.

这篇关于使用鼠标中键滚动按钮禁用浏览器滚动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆