日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程资源 > 编程问答 >内容正文

编程问答

css3加载ing动画

發(fā)布時(shí)間:2023/12/20 编程问答 26 豆豆
生活随笔 收集整理的這篇文章主要介紹了 css3加载ing动画 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

項(xiàng)目中ajax交互成功前總會(huì)需要給用戶提醒,比如請(qǐng)稍候、正在加載中等等,那個(gè)等待的動(dòng)圖以前項(xiàng)目中用的是gif,在移動(dòng)端畫(huà)質(zhì)很渣,有毛邊,于是在新項(xiàng)目中用css3展示加載中的動(dòng)畫(huà)效果。

function tipLoading(type,top,left){if($("arrorbox"))$('#arrorbox').remove();var dataType=['<div class="sk-circle"><div class="sk-circle1 sk-child"></div><div class="sk-circle2 sk-child"></div><div class="sk-circle3 sk-child"></div><div class="sk-circle4 sk-child"></div><div class="sk-circle5 sk-child"></div><div class="sk-circle6 sk-child"></div><div class="sk-circle7 sk-child"></div><div class="sk-circle8 sk-child"></div><div class="sk-circle9 sk-child"></div><div class="sk-circle10 sk-child"></div><div class="sk-circle11 sk-child"></div><div class="sk-circle12 sk-child"></div></div>','<div class="spinner"><div class="bounce1"></div><div class="bounce2"></div><div class="bounce3"></div></div>',],html="<div class='tiploading'></div>", type = type || 0,top = top || "48%",left = left || "50%",timer= null;$("body").append(html);if($(".tiploading")){$(".tiploading").css({"margin-left": -20+"px","left": left,"top": top});!type==1?$(".tiploading").append(dataType[type]+"<div class='tiploading-con'>請(qǐng)稍候</div>"):$(".tiploading").append(dataType[type]+"<div class='tiploading-con'></div>");} } function tipLoadingRemove(){if($(".tiploading")){$(".tiploading").remove();} }

js放在項(xiàng)目公用里,樣式放到公用樣式里,調(diào)用的時(shí)候tipLoading(type,top,left),在ajax交互成功前調(diào)用,成功后調(diào)用tipLoadingRemove()移除,也可以加個(gè)超時(shí),不過(guò)讓刪了,type現(xiàn)在只有兩種,網(wǎng)上有很多種,可以再加自己需要的,默認(rèn)第一種0,傳個(gè)1就是第二種。top、left為位置。

css↓↓

/*2016-12-10 wm 加載樣式*/ .tiploading{width: 40px;height: 40px;background: rgba(0,0,0,.7);position:fixed;border-radius: 10px;z-index: 9999;} .tiploading .tiploading-con{position:absolute;bottom:10px;left:0;width: 100%;height: 20px;line-height: 20px;font-size: 12px;color:#fff;text-align: center;} /*type1*/ .sk-circle {width: 30px;height: 30px;position: relative;top:5px;left:5px;} .sk-circle .sk-child {width: 100%;height: 100%;position: absolute;left: 0;top: 0;} .sk-circle .sk-child:before {content: '';display: block;margin: 0 auto;width: 15%;height: 15%;background-color: #fff;border-radius: 100%;-webkit-animation: sk-circleBounceDelay 1.2s infinite ease-in-out both;animation: sk-circleBounceDelay 1.2s infinite ease-in-out both;} .sk-circle .sk-circle2 {-webkit-transform: rotate(30deg);-ms-transform: rotate(30deg);transform: rotate(30deg); } .sk-circle .sk-circle3 {-webkit-transform: rotate(60deg);-ms-transform: rotate(60deg);transform: rotate(60deg); } .sk-circle .sk-circle4 {-webkit-transform: rotate(90deg); -ms-transform: rotate(90deg); transform: rotate(90deg); } .sk-circle .sk-circle5 {-webkit-transform: rotate(120deg); -ms-transform: rotate(120deg); transform: rotate(120deg); } .sk-circle .sk-circle6 {-webkit-transform: rotate(150deg); -ms-transform: rotate(150deg); transform: rotate(150deg); } .sk-circle .sk-circle7 {-webkit-transform: rotate(180deg); -ms-transform: rotate(180deg); transform: rotate(180deg); } .sk-circle .sk-circle8 {-webkit-transform: rotate(210deg); -ms-transform: rotate(210deg); transform: rotate(210deg); } .sk-circle .sk-circle9 {-webkit-transform: rotate(240deg); -ms-transform: rotate(240deg); transform: rotate(240deg); } .sk-circle .sk-circle10 {-webkit-transform: rotate(270deg); -ms-transform: rotate(270deg); transform: rotate(270deg); } .sk-circle .sk-circle11 {-webkit-transform: rotate(300deg); -ms-transform: rotate(300deg); transform: rotate(300deg); } .sk-circle .sk-circle12 {-webkit-transform: rotate(330deg); -ms-transform: rotate(330deg); transform: rotate(330deg); } .sk-circle .sk-circle2:before {-webkit-animation-delay: -1.1s; animation-delay: -1.1s; } .sk-circle .sk-circle3:before {-webkit-animation-delay: -1s; animation-delay: -1s; } .sk-circle .sk-circle4:before {-webkit-animation-delay: -0.9s; animation-delay: -0.9s; } .sk-circle .sk-circle5:before {-webkit-animation-delay: -0.8s; animation-delay: -0.8s; } .sk-circle .sk-circle6:before {-webkit-animation-delay: -0.7s; animation-delay: -0.7s; } .sk-circle .sk-circle7:before {-webkit-animation-delay: -0.6s; animation-delay: -0.6s; } .sk-circle .sk-circle8:before {-webkit-animation-delay: -0.5s; animation-delay: -0.5s; } .sk-circle .sk-circle9:before {-webkit-animation-delay: -0.4s; animation-delay: -0.4s; } .sk-circle .sk-circle10:before {-webkit-animation-delay: -0.3s; animation-delay: -0.3s; } .sk-circle .sk-circle11:before {-webkit-animation-delay: -0.2s; animation-delay: -0.2s; } .sk-circle .sk-circle12:before {-webkit-animation-delay: -0.1s; animation-delay: -0.1s; } @-webkit-keyframes sk-circleBounceDelay {0%, 80%, 100% {-webkit-transform: scale(0); transform: scale(0); } 40% {-webkit-transform: scale(1); transform: scale(1); } } @keyframes sk-circleBounceDelay {0%, 80%, 100% {-webkit-transform: scale(0); transform: scale(0); } 40% {-webkit-transform: scale(1); transform: scale(1); } } /*type2*/ .spinner {margin: 10px auto ;width: 40px;text-align: center;} .spinner > div {width: 8px;height: 8px;background-color: #fff;border-radius: 100%;display: inline-block;-webkit-animation: sk-bouncedelay 1.4s infinite ease-in-out both;animation: sk-bouncedelay 1.4s infinite ease-in-out both;} .spinner .bounce1 {-webkit-animation-delay: -0.32s;animation-delay: -0.32s;} .spinner .bounce2 {-webkit-animation-delay: -0.16s;animation-delay: -0.16s;} @-webkit-keyframes sk-bouncedelay {0%, 80%, 100% { -webkit-transform: scale(0) } 40% { -webkit-transform: scale(1.0) } } @keyframes sk-bouncedelay {0%, 80%, 100% {-webkit-transform: scale(0); transform: scale(0); } 40% {-webkit-transform: scale(1.0); transform: scale(1.0); } }

type1

本文轉(zhuǎn)載自:http://www.cnblogs.com/wmlucky/p/6195851.html

轉(zhuǎn)載于:https://www.cnblogs.com/Eton/p/6200616.html

總結(jié)

以上是生活随笔為你收集整理的css3加载ing动画的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。