【问题标题】:deactivate scrolling but show scrollbar?停用滚动但显示滚动条?
【发布时间】:2021-04-17 17:53:02
【问题描述】:

当我将 body 和 HTML 的高度更改为 100% 的页面滚动条消失时,我该如何阻止它

i'm getting two scrollbars 之后是trying this

谢谢

【问题讨论】:

  • 请添加您制作的代码或检查如何创建示例来复制问题。另一方面尝试在正文溢出中添加以下内容:隐藏

标签: html css scroll scrollbar


【解决方案1】:

不要更改css,这将删除scrollbar,正如您所说,更改页面布局,请尝试调用jquery function

JS

// call your pop up and inside that function add below
$('body').on('scroll mousewheel touchmove', function(e) {
      e.preventDefault();
      e.stopPropagation();
      return false;
});

然后当您关闭模式时,调用相同的函数但替换on off

【讨论】:

  • 我讨厌 Jquery,但我可以在 vanilla js 中做到这一点,谢谢
猜你喜欢
  • 2019-04-21
  • 2014-01-17
  • 2012-07-05
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-07-27
  • 2014-11-02
  • 2012-06-13
相关资源
最近更新 更多