[英]why my $(window).load(function() is not working in document.ready function?
我的 windows.load 函数在 document.ready 中不起作用
$(document).ready(function(){
//this is for nimation
$(".progress-bar-fill").css({"width":"100%","transition":"5s"});
// my this function is not working
$(window).load(function() {
$(".overlay").fadeOut();
});
});
你的代码说:
但是,当您的窗口加载注册发生时,窗口可能已经加载。
您还使用了错误的方法来订阅窗口加载事件。
尝试:
$(document).ready(function(){ //this is for nimation $(".progress-bar-fill").css({"width":"100%","transition":"5s"}); }); $(window).on("load", function() { $(".overlay").fadeOut(); });
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0/jquery.min.js"></script> <div class="progress-bar-fill">progress bar</div> <div class="overlay">overlay</div>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.