首页 > 解决方案 > CSS 预加载器淡出

问题描述

我怎样才能让我的预加载器顺利淡出,我下面的代码不起作用

CSS

.body{
     width:100%;
     height:1000px;
     overflow:hidden;
    }
    #loader{
         width:100px;
         height:100px;

         border:solid 5px blue;
         border-top:solid 5px #F69;
         border-bottom:solid 5px #F69;
         border-radius:100%;

         position:absolute;
         top:0;
         left:0;
         right:0;
         bottom:0;
         margin:auto;

         -webkit-animation: spin 2s linear infinite;
         animation: spin 2s linear infinite;

        }
    @keyframes spin{
            from{ transform:rotate(0deg);  width:100px;
            height:100px;}
            to{ transform:rotate(360deg); width:100px;
            height:100px;}
        }

代码

<body onload="myFunction()" >
   <div id="loader" style="z-index:999;">
   </div>
 </body>

脚本

    功能我的功能(){
        $("bloader").fadeOut(2000);
        myVar = setTimeout(showPage, 2000);
    }

标签: jquerycssfadeout

解决方案


在你的脚本中

$("bloader").fadeOut(2000);

应该

$("#loader").fadeOut(2000);

推荐阅读