我想知道是否有一种方法可以阻止滚动条,直到 div 及其加载器达到不显示的程度。我不知道这是否可以仅使用 html 或 css 来完成。有什么建议吗?
#loader {
background: #eeeeee;
bottom: 0;
height: 100%;
left: 0;
right: 0;
top: 0;
width: 100%;
display:block;
margin: 0 auto;
position: relative;
overflow: hidden;
z-index: 9999;
}
#loaderInner {
background:#eeeeee url(https://dl.dropboxusercontent.com/s/asdfghfdsas/loader.gif) center center no-repeat;
background-size: 250px 250px;
position: absolute;
height: 250px;
width: 250px;
display:block;
margin: 0 auto;
top: 50%;
left: 50%;
margin: -125px 0px 0px -125px;
}
body#layout #loader {
display:none;
overflow: scroll;
}
最佳答案
您可以使用一些简单的 CSS 来防止页面滚动。但是您需要使用 JS 来处理何时应用此类。
CSS
body.loading {
overflow: hidden;
}
关于html - 如何阻止滚动直到加载程序不显示任何内容?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35645314/