我被一个看似简单但却找不到解决办法的问题困住了. 我想呈现一个页面与加载器,涵盖所有的网页.好的.一段时间后,覆盖消失,并显示页面的元素,但我不能对他们进行操作.我的工作是不透明的风格.遵循代码
$(document).ready(function() {
// Wait 3 seconds
setTimeout(function() {
document.body.style.overflow = "visible";
document.getElementById("modalLoader").setAttribute("style", "opacity: 0;");
});
});
.loaderScreen {
position: fixed;
top: 0;
left: 0;
display: block;
height: 100%;
background-color: whitesmoke;
opacity: 1;
width: 100%;
z-index: 100;
overflow-y: hidden;
transition: opacity 2s;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
<div id="modalLoader" class="container-fluid loaderScreen text-center">
<h3 class="animate-charcter">Web page is loading...</h3>
</div>
此时,只有在"modalLoader"元素上设置display:none,才能对页面的元素进行操作.
我忽略了什么?
非常感谢.