Javascript I';m无法增加页面加载程序动画时间
我正在尝试向我的站点添加加载程序,当我尝试运行我的代码时,我注意到加载程序动画持续时间非常短,因此我添加了JQuery代码(setTimeout),为了进行测试,我将其编写为运行10秒。但它不起作用。如果有人能帮我 演示的Github链接: 我的代码:Javascript I';m无法增加页面加载程序动画时间,javascript,html,jquery,css,loader,Javascript,Html,Jquery,Css,Loader,我正在尝试向我的站点添加加载程序,当我尝试运行我的代码时,我注意到加载程序动画持续时间非常短,因此我添加了JQuery代码(setTimeout),为了进行测试,我将其编写为运行10秒。但它不起作用。如果有人能帮我 演示的Github链接: 我的代码: <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<style type="text/css">
#loading{
position: fixed;
width: 100%;
height: 100vh;
background: #fff url('Skateboarding.gif') no-repeat center center ;
z-index: 99999;
}
</style>
<body onload="myFunction()">
<div id="loading"></div>
<h1>HELLO WORLD</h1>
<h1>HELLO WORLD</h1>
<h1>HELLO WORLD</h1>
<h1>HELLO WORLD</h1>
<h1>HELLO WORLD</h1>
<script type="text/javascript">
function myFunction(){
preloader.style.display = 'none';
};
</script>
<script>
jQuery(document).ready(function () {
$(window).load(function () {
setTimeout(function(){
$('#loading').fadeOut('slow', function () {
});
},4000);
});
</script>
</body>
</html>
#装载{
位置:固定;
宽度:100%;
高度:100vh;
背景:#fff url('Skateboarding.gif')无重复中心;
z指数:99999;
}
你好,世界
你好,世界
你好,世界
你好,世界
你好,世界
函数myFunction(){
preload.style.display='none';
};
jQuery(文档).ready(函数(){
$(窗口)。加载(函数(){
setTimeout(函数(){
$(“#加载”).fadeOut('slow',function(){
});
},4000);
});
回顾一下上一个脚本。它缺少正确的标点符号
<script>
jQuery(document).ready(function () {
$(window).load(function () {
setTimeout(function(){
$('#loading').fadeOut('slow', function () {
});
},4000);
});
}); //THIS WAS MISSING
</script>
jQuery(文档).ready(函数(){
$(窗口)。加载(函数(){
setTimeout(函数(){
$(“#加载”).fadeOut('slow',function(){
});
},4000);
});
})这个不见了