/**
* Created by jljsj on 15/6/3.
*/
$(function () {
var loadData = ["/static/easeljs-0.8.0.min.js", "/static/TweenMax.min.js", "/static/home.js", "https://t.alipayobjects.com/images/T1CFtgXb0jXXXXXXXX.jpg"];
var animEndStr = 'webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend';
var loadFunc={
init:function(){
var self=this;
self.body=$("body");
self.header=$("#header")||$("header");
self.main=$(".main");
self.footer=$("#footer")||$("footer");
self.addLoad()
},
addLoad:function (){
var self=this;
self.loadBox=$("
" +
"
" +
"
" +
"
Ant Design" +
"
" +
"
" +
"
").appendTo(self.body);
self.loadBar=self.loadBox.find(".load-bar");
var loadText=self.loadBox.find("span"),
str=loadText.text(),
loadClass=["yoyo-load0","yoyo-load1","yoyo-load2","yoyo-load3","yoyo-load4","yoyo-load5"];
loadText.empty();
function c_random(num,arrlen){
var arr=[];
function r(i){
var t=Math.round(Math.random()*(num-1));
if(t==arr[i-1]){
r(i);
return
}
arr.push(t)
}
for(var i=0;i0&&i"+t+"")
}
self.load()
},
load:function (){
var self=this,lArr=[],num= 0,tNum=0;
function getJS(){
for(var i=0;i=lArr.length){
self.loadBox.addClass("load-out").one(animEndStr, function () {
self.loadBox.remove();
$("").appendTo($("body"));
});
}else{
$("").appendTo($("body"));
}
tNum++;
self.loadBar.css("width",tNum/loadData.length*100+"%");
}
}
for(var i=0;i= 0) {
lArr.push(str);
num++;
if (num >= loadData.length) {
setTimeout(getJS,500);
}
}else{
var img = new Image();
img.onload = img.onerror = function () {
num++;
tNum++;
self.loadBar.css("width",tNum/loadData.length*100+"%");
if (num >= loadData.length) {
setTimeout(getJS,500);
}
};
img.src = str;
}
}
}
};
$().ready(function (){
loadFunc.init()
});
});