如何设置禁止蒙层底部页面不随滚动?

更新于
2026-09-30 19:52:09
1阅读来源:SEO基础
  • 内容介绍
  • 文章标签
  • 相关推荐

本文共计206个文字,预计阅读时间需要1分钟。

如何设置禁止蒙层底部页面不随滚动?

plaintextgistfile1.txt: 打开弹窗 关闭弹窗 // .stopBodyScroll.jslet _stopBodyScroll={ options: { bodyEl: document.body, topIndex: 0 }, init: function(isFixed) { if (isFixed) { this.options.topIndex=window.scrollY; this.options.bodyEl.style... } }}

如何设置禁止蒙层底部页面不随滚动?

gistfile1.txt

Document 打开弹窗 // ./stopBodyScroll.js let _stopBodyScroll = { options: { bodyEl: document.body, topIndex: 0 }, init: function(isFixed) { if (isFixed) { this.options.topIndex = window.scrollY this.options.bodyEl.style.position = 'fixed' this.options.bodyEl.style.top = -this.options.topIndex + 'px' } else { this.options.bodyEl.style.position = '' this.options.bodyEl.style.top = '' window.scrollTo(0, this.options.topIndex) // 回到原先的top } } }

本文共计206个文字,预计阅读时间需要1分钟。

如何设置禁止蒙层底部页面不随滚动?

plaintextgistfile1.txt: 打开弹窗 关闭弹窗 // .stopBodyScroll.jslet _stopBodyScroll={ options: { bodyEl: document.body, topIndex: 0 }, init: function(isFixed) { if (isFixed) { this.options.topIndex=window.scrollY; this.options.bodyEl.style... } }}

如何设置禁止蒙层底部页面不随滚动?

gistfile1.txt

Document 打开弹窗 // ./stopBodyScroll.js let _stopBodyScroll = { options: { bodyEl: document.body, topIndex: 0 }, init: function(isFixed) { if (isFixed) { this.options.topIndex = window.scrollY this.options.bodyEl.style.position = 'fixed' this.options.bodyEl.style.top = -this.options.topIndex + 'px' } else { this.options.bodyEl.style.position = '' this.options.bodyEl.style.top = '' window.scrollTo(0, this.options.topIndex) // 回到原先的top } } }