Javascript Opera - 关闭文档正文滚动(暂时)

发布于 2024-11-17 15:28:21 字数 130 浏览 5 评论 0原文

我有一个使用鼠标滚轮进行缩放的图片查看器。工作正常,但在 Opera 中除外,滚轮首先滚动页面,然后触发滚轮事件,这不太理想(因为现在图片已在页面上向上或向下移动)。

因此,我想在查看器处于活动状态时关闭正文滚动。应该不会太难吧?

I've got a pic viewer that uses the mouse wheel to zoom. Works fine except in Opera, the wheel scrolls the page first, then fires the wheel event, which is less than desirable (since now the picture has moved up or down the page).

So, I want to turn off the body scroll while the viewer is active. Shouldn't be too hard, right?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

可爱暴击 2024-11-24 15:28:21

滚动的 JavaScript 是否也调用 event.preventDefault() ?这应该有效,尽管我最近没有亲自测试过。

Does the JavaScript that scrolls also call event.preventDefault()? This should work, though I haven't tested it recently myself.

风尘浪孓 2024-11-24 15:28:21

这可能有用吗?

body {
    overflow: hidden;
}

possibly this might work?

body {
    overflow: hidden;
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文