数据加载loading...
2016-09-26 本文已影响40人
black白先森
/*-------------- 数据点加载小动画 --------------*/
.loader-container{
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.loader-wrap {
position: absolute;
top: 50%;
left: 50%;
-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
text-align: center;
display: block;
vertical-align: middle;
}
.loader-wrap>span {
display: inline-block;
width: 16px;
height: 16px;
background-color: #3bb4f2;
-webkit-animation: amt-bouncedelay 1.4s infinite ease-in-out both;
animation: amt-bouncedelay 1.4s infinite ease-in-out both;
-webkit-border-radius: 100%;
border-radius: 100%;
-webkit-transform-style: preserve-3d;
-webkit-backface-visibility: hidden;
}
.loader-wrap>span+span {
margin-left: 5px
}
.loader-wrap .loader-bounce1 {
-webkit-animation-delay: -.32s;
animation-delay: -.32s
}
.loader-wrap .loader-bounce2 {
-webkit-animation-delay: -.16s;
animation-delay: -.16s
}
@-webkit-keyframes amt-bouncedelay {
0%,80%,to {
-webkit-transform: scale(0);
transform: scale(0)
}
40% {
-webkit-transform: scale(1);
transform: scale(1)
}
}
@keyframes amt-bouncedelay {
0%,80%,to {
-webkit-transform: scale(0);
transform: scale(0)
}
40% {
-webkit-transform: scale(1);
transform: scale(1)
}
}
// 小圆点交叉加载动画
$.dotLoading = function(type) {
var _type = type || "show";
var html_tpl = '<div class="loader-container" id="loader_container">' +
'<div class="loader-wrap">' +
'<span class="loader-bounce1"></span>'+
'<span class="loader-bounce2"></span>'+
'<span class="loader-bounce3"></span>'+
'</div>'+
'</div>';
// 显示加载;
$(".loader-container").remove();
if(_type == "show"){
$("body").append(html_tpl);
}
// 禁止滑动
$("body").on("touchmove", "#loader_container",function(event){
event.preventDefault();
event.stopPropagation();
return false;
});
};