禁用任何形式的浏览器窗口滚动?

编程入门 行业动态 更新时间:2024-10-26 10:39:33
本文介绍了禁用任何形式的浏览器窗口滚动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

是否有禁用滚动的方法?不仅是滚动条​​,还是浏览器窗口的全部功能?

Is there a way to disable scrolling? Not just the scrollbar, but the entire functionality from the browser window?

推荐答案

基于您对Keit的回答,您不想在打开灯箱时激活滚动功能吗? 如果是这种情况,您可以在打开带有以下CSS的灯箱的同时向车身添加一个类

based on your answer to Keit you dont want to scroll be active when you have a lightbox open? if that is the case you can add a class to the body at the same time as you open the lightbox with the following css

此解决方案的优点是保留滚动空间",以使站点不会跳转,更像是将其禁用.希望对您有帮助

And the nice thing about this solution it keeps the scroll "space" so the site do not jump, its more like it disables it. hope this helps

body.noscroll { position: fixed; overflow-y: scroll; width: 100%; } $('body').addClass('noscroll'); $('body').removeClass('noscroll');

更多推荐

禁用任何形式的浏览器窗口滚动?

本文发布于:2023-10-08 08:58:40,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1472132.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:浏览器   形式   窗口

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!