<分区>
编辑问题以包含 desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem .这将有助于其他人回答问题。
关闭 7 年前。
<分区>
编辑问题以包含 desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem .这将有助于其他人回答问题。
关闭 7 年前。
当你打开一个模式,比如配置文件,然后使用 esc 再次关闭它时,你可以看到当重新添加边栏时内容向左移动。我怎样才能防止这种转变?我已经尝试将 overflow-y:visible
添加到 html,但仍然发生这种转变。
最佳答案
当您点击打开弹出窗口时,remodal-is-locked
添加到 html
标签中。淡出动画结束后删除的类。
问题是,当您关闭弹出窗口时,html 的 overflow:hidden
仍然存在,因为类 remodal-is-locked
所以在这种情况下,两个滚动条(html
或 popup
) 正在显示,因此内容位于特定位置。就在动画结束后,您删除了该类,html
再次“获取”他的 scollbar。
附言问题出在 remodal.min.js
脚本中,因此您必须编辑此文件。尽管脚本被缩小了,但我会尝试将您指向具体位置。
红色 - 关闭
函数。
绿色 - 回调函数,在动画结束后。
blue - 从 html 中删除类 remodal-is-locked
的函数。
解决方案
当您开始淡出动画时移除该类。 (紫色 箭头)
关于html - 打开/关闭模态时防止内容移动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32366416/