CSS3三种不同的加载样式

CSS3三种不同的加载样式

添加时间:2021-02-18 00:15:47
站长推荐丨赞助论坛,可获取海量资源终身免费下载权限奥!
举报 举报
收藏
预览
附件 附件
  • 模板类型模板类型:进度条
  • 模板颜色模板颜色:入门级
  • 下载积分下载积分:28 米粒
  • 下载权限下载权限:

    赞助会员

本文演示了项目中常用的三种不同加载动画,代码都很简单。
CSS3三种不同的加载样式
分类:css3 > 进度条 难易:入门级

演示一:圆圈加载进度

<ul id="progress">
    <li><div id="layer1" class="ball"></div><div id="layer7" class="pulse"></div></li>
    <li><div id="layer2" class="ball"></div><div id="layer8" class="pulse"></div></li>
    <li><div id="layer3" class="ball"></div><div id="layer9" class="pulse"></div></li>
    <li><div id="layer4" class="ball"></div><div id="layer10" class="pulse"></div></li>
    <li><div id="layer5" class="ball"></div><div id="layer11" class="pulse"></div></li>
</ul>
ul#progress{
    list-style:none;
    width:125px;
    margin:0 auto;
    padding-top:50px;
    padding-bottom:50px;
}
ul#progress li{
    float:left;
    position:relative;
    width:15px;
    height:15px;
    border:1px solid #fff;
    border-radius:50px;
    margin-left:10px;
    border-left:1px solid #111;border-top:1px solid #111;border-right:1px solid #333;border-bottom:1px solid #333;
    background:#000;
}
ul#progress li:first-child{margin-left:0;}
.running .ball{
    background-color:#2187e7;
    background-image:-moz-linear-gradient(90deg, #2187e7 25%, #a0eaff);
    background-image:-webkit-linear-gradient(90deg, #2187e7 25%, #a0eaff);

    width:15px;
    height:15px;
    border-radius:50px;
    -moz-transform:scale(0);
    -webkit-transform:scale(0);

    -moz-animation:loading 1s linear forwards;
    -webkit-animation:loading 1s linear forwards;
}
.running .pulse{
    width:15px;
    height:15px;
    border-radius:30px;
    border:1px solid #00c6ff;
    box-shadow:0 0 5px #00c6ff;
    position:absolute;
    top:-1px;
    left:-1px;
    -moz-transform:scale(0);
    -webkit-transform:scale(0);

    -webkit-animation:pulse 1s ease-out;
    -moz-animation:pulse 1s ease-out;
}
#layer1{-moz-animation-delay:0.5s;-webkit-animation-delay:0.5s;}
#layer2{-moz-animation-delay:1s;-webkit-animation-delay:1s;}
#layer3{-moz-animation-delay:1.5s;-webkit-animation-delay:1.5s;}
#layer4{-moz-animation-delay:2s;-webkit-animation-delay:2s;}
#layer5{-moz-animation-delay:2.5s;-webkit-animation-delay:2.5s;}
#layer7{-moz-animation-delay:1.5s;-webkit-animation-delay:1.5s;}
#layer8{-moz-animation-delay:2s;-webkit-animation-delay:2s;}
#layer9{-moz-animation-delay:2.5s;-webkit-animation-delay:2.5s;}
#layer10{-moz-animation-delay:3s;-webkit-animation-delay:3s;}
#layer11{-moz-animation-delay:3.5s;-webkit-animation-delay:3.5s;}

@-moz-keyframes loading{
    0%{-moz-transform:scale(0,0);}
    100%{-moz-transform:scale(1,1);}	
}

@-webkit-keyframes loading{
    0%{-webkit-transform:scale(0,0);}
    100%{-webkit-transform:scale(1,1);}	
}


@-moz-keyframes pulse{
    0%  {-moz-transform:scale(0);opacity:0;}
    10% {-moz-transform:scale(1);opacity:0.5;}
    50% {-moz-transform:scale(1.75);opacity:0;}
    100%{-moz-transform:scale(0);opacity:0;}  
}

@-webkit-keyframes pulse{
    0%  {-webkit-transform:scale(0);opacity:0;}
    10% {-webkit-transform:scale(1);opacity:0.5;}
    50% {-webkit-transform:scale(1.75);opacity:0;}
    100%{-webkit-transform:scale(0);opacity:0;}    
}
$('#progress').removeClass('running');
$('.trigger').click(function() {
    $('#progress').removeClass('running').delay(10).queue(function(next) {
        $(this).addClass('running');
        next();
    });
    return false;
});

演示二:网页进度加载

<div id="content">
      <span class="expand"></span>
</div>
$('#content').removeClass('fullwidth');
$('.triggerFull').click(function() {
    $('#content').removeClass('fullwidth').delay(10).queue(function(next) {
        $(this).addClass('fullwidth');
        next();
    });
    return false;
});
#content{
    width:100%;
    height:5px;
    margin:50px auto;
    background:#000;
}

.fullwidth .expand{
    width:100%;
    height:1px;
    margin:2px 0;
    background:#2187e7;
    position:absolute;
    box-shadow:0px 0px 10px 1px rgba(0,198,255,0.7);
    -moz-animation:fullexpand 10s ease-out;
    -webkit-animation:fullexpand 10s ease-out;
}

@-moz-keyframes fullexpand{
    0%{width:0px;}
    100%{ width:100%;}	
}
@-webkit-keyframes fullexpand{
    0%{width:0px;}
    100%{ width:100%;}	
}

演示三:类似音量加载进度

<ul id="loadbar">
    <li><div id="layerFill1" class="bar"></div></li>
    <li><div id="layerFill2" class="bar"></div></li>
    <li><div id="layerFill3" class="bar"></div></li>
</ul>
ul#loadbar{
    list-style:none;
    width:140px;
    margin:0 auto;
    padding-top:50px;
    padding-bottom:75px;
}
ul#loadbar li{
    float:left;
    position:relative;
    width:11px;
    height:26px;
    margin-left:1px;
    border-left:1px solid #111;border-top:1px solid #111;border-right:1px solid #333;border-bottom:1px solid #333;
    background:#000;
}

ul#loadbar li:first-child{margin-left:0;}

.ins .bar{
    background-color:#2187e7; 
    background-image:-moz-linear-gradient(45deg, #2187e7 25%, #a0eaff);
    background-image:-webkit-linear-gradient(45deg, #2187e7 25%, #a0eaff);
    width:11px;
    height:26px;
    opacity:0;
    -webkit-animation:fill .5s linear forwards;
    -moz-animation:fill .5s linear forwards;
}

#layerFill1{-moz-animation-delay:0.5s;-webkit-animation-delay:0.5s;}
#layerFill2{-moz-animation-delay:1s;-webkit-animation-delay:1s;}
#layerFill3{-moz-animation-delay:1.5s;-webkit-animation-delay:1.5s;}
#layerFill4{-moz-animation-delay:2s;-webkit-animation-delay:2s;}
#layerFill5{-moz-animation-delay:2.5s;-webkit-animation-delay:2.5s;}
#layerFill6{-moz-animation-delay:3s;-webkit-animation-delay:3s;}
#layerFill7{-moz-animation-delay:3.5s;-webkit-animation-delay:3.5s;}
#layerFill8{-moz-animation-delay:4s;-webkit-animation-delay:4s;}
#layerFill9{-moz-animation-delay:4.5s;-webkit-animation-delay:4.5s;}
#layerFill10{-moz-animation-delay:5s;-webkit-animation-delay:5s;}

@-moz-keyframes fill{
    0%{ opacity:0;}
    100%{ opacity:1;}	
}

@-webkit-keyframes fill{
    0%{ opacity:0;}
    100%{ opacity:1;}	
}
$('#loadbar').removeClass('ins');
$('.triggerBar').click(function() {
    $('#loadbar').removeClass('ins').delay(10).queue(function(next) {
        $(this).addClass('ins');
        next();
    });
    return false;
});
相关内容推荐
资源求助发帖
查看更多发帖

*

回帖描述:

*

链接类型:

*

下载链接:

密码:
发帖规则:回帖内容为会员之间的私信,普通网友无法查看。
免责声明:回帖中提供的链接内容仅供会员之间学习参考使用,获取内容后请在法律法规范围内使用。回帖提供的内容应符合法律法规要求,不得违反法律法律的要求。
站点权责:回帖内容如违反法律法规,站点有权封停账号使用权利。对用户举报的内容,站点有责任及时删除违规内容。
热点内容推荐
标题:CSS3三种不同的加载样式

*

描述:
平均回复时间:3-10分钟
规则介绍:悬赏寻求论坛网友分享资源,站点对分享内容的准确性,合法性,版权等没有足够的监管能力。如果您发现资源不正确,无法使用,不符合法律法律等情况,您可以直接举报资源。站长将尽快核实您的举报,并根据情况,采取封号,退换米粒等处理。

*

回帖描述:

*

链接类型:

*

阅读权限:

*

下载链接:

密码:
发帖规则:回帖内容为会员之间的私信,普通网友无法查看。
免责声明:回帖中提供的链接内容仅供会员之间学习参考使用,获取内容后请在法律法规范围内使用。回帖提供的内容应符合法律法规要求,不得违反法律法律的要求。
站点权责:回帖内容如违反法律法规,站点有权封停账号使用权利。对用户举报的内容,站点有责任及时删除违规内容。
  • 背景波浪
  • 背景波浪
  • 波浪
  • 波浪
客服
在线咨询
周一 至 周日 9:00 ~ 22:00
QQ:1326974360
微信:juyoubuluo6688
客服热线
18205485173
工作日 9:00 ~ 18:00
微信扫码咨询
客户服务
欢迎咨询服务
咨询量较多时,请耐心等待
社群

关注公众号

获取更多资讯

扫码进群(QQ)

与更多大牛交流沟通

0.097846s