fut*_*ime 5 css scroll mobile-safari
当模态叠加打开时,我试图阻止页面的主体滚动(根本没有).
模态覆盖整个屏幕({position: fixed;top:0;left:0;right:0;bottom:0;}),它有自己的滚动.但是,当我在模态窗口上运行滚动结束时,主窗口开始在它后面滚动.我已经尝试了一切我能想到的让身体停止滚动.这些事情没有奏效:
body {
overflow: hidden;
pointer-events: none;
-webkit-overflow-scrolling: none;
}
#content { /* which contains all the non-modal content of the body */
-webkit-transform: scale(0);
position: relative; left: 100%;
}
Run Code Online (Sandbox Code Playgroud)
看起来你很接近。
当你的模式打开时,尝试这个 CSS:
body{
overflow:visible;
max-height:100%; /* or 100px or something smaller than the screen if your viewport isn't set */
height:100% /* or 100px or something smaller than the screen */
}
Run Code Online (Sandbox Code Playgroud)