禁用任何形式的浏览器窗口滚动? [英] Disable browser window scrolling of any kind?

查看:64
本文介绍了禁用任何形式的浏览器窗口滚动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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');

这篇关于禁用任何形式的浏览器窗口滚动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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