温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

HTML5如何实现等待加载动画的效果

发布时间:2020-07-11 16:12:59 来源:亿速云 阅读:209 作者:Leah 栏目:web开发

HTML5如何实现等待加载动画的效果?相信很多没有经验的人对此束手无策,为此本文总结了问题出现的原因和解决方法,通过这篇文章希望你能解决这个问题。

                                                           详细代码如下所示:

<p class="loading">
     <p>100<span></span></p>
</p>
  *{margin:0;padding:0;}
    .loading{
          height:100%;width:100%;position:fixed;background:rgba(255,255,255,1);
    }
    .loading >p{position:absolute;left:0;right:0;top:0;bottom:0;margin:auto;height:160px;width:160px;text-align: center;line-height:160px;font-size: 30px;color:#f00;}
    .loading p span{position:absolute;display:block;height:140px;width:140px;margin:10px;border-radius:50%;-webkit-box-shadow:0 2px 3px rgba(102,197,37,0.8); animation:loading ease 1s infinite;left:0;top:0;}
    @keyframes loading{
       0%{transform:rotate(0deg)}
       100%{transform:rotate(360deg)}
    }

HTML5如何实现等待加载动画的效果

<p class="loading">
     <p>
  <i></i>
  <i></i>
  <i></i>
  <i></i>
  <i></i>
</p>
</p>
 *{margin:0;padding:0;}
    .loading{
          height:100%;width:100%;position:fixed;background:rgba(255,255,255,0.95);
    }
    .loading >p{position:absolute;left:0;right:0;top:0;bottom:0;margin:auto;height:30px;width:120px;}
    .loading >p i{display: block;float:left;margin:0 5px; width:5px;height:30px;background:#f00;transform:scaleY(0.3);
                   animation:loading 1s ease infinite alternate;
    }
.loading >p i:nth-child(2){animation-delay:0.1s;}
.loading >p i:nth-child(3){animation-delay:0.2s;}
.loading >p i:nth-child(4){animation-delay:0.3s;}
.loading >p i:nth-child(5){animation-delay:0.4s;}
    @keyframes loading{
           0,40%,100%{transform:scaleY(0.3);}
           20%{transform:scaleY(1);}
    }

HTML5如何实现等待加载动画的效果

其实我想做的是加载进度条效果,又没有特别好的办法,判断图片这种总感觉比较低级。

这是代码,有完美解决方案了解决。

<script>
    document.onreadystatechange=function(){
      if(document.readyState=='complete'){
         $('.loading').fadeOut();
      }
    }
</script>

看完上述内容,你们掌握HTML5如何实现等待加载动画的效果的方法了吗?如果还想学到更多技能或想了解更多相关内容,欢迎关注亿速云行业资讯频道,感谢各位的阅读!

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI