// $(document).ready(function () { var imgdefereds = []; //定义一个操作数组 $('.rocket-wrapper img').each(function () { //遍历所有图片,将图片 var dfd = $.Deferred(); //定义一个将要完成某个操作的对象 $(this).bind('load', function () { dfd.resolve(); //图片加载完成后,表示操作成功 }); if (this.complete) { //如果图片加载状态为完成,那么也标识操作成功 setTimeout(function () { dfd.resolve(); }, 10); } imgdefereds.push(dfd); //将所有操作对象放入数组中 }) $.when.apply(null, imgdefereds).done(function () { //注册所有操作完成后的执行方法 var rocketImgs = document.querySelectorAll('.rocket-wrapper img'); for (var i = 0; i < rocketImgs.length; i++) { rocketImgs[i].setAttribute('class', 'end'); } document.getElementById('rocket_body').style.animation = 'rocket_body 2s linear 2.2s infinite'; // document.getElementById('rocket_block_left_2').style = 'animation:rocket_block_left_2 3s linear 1s infinite'; // document.getElementById('rocket_block_right_1').style = 'animation:rocket_block_right_1 3s linear 1s infinite'; document.getElementById('rocket_halo_L').style.animation = 'rocket_halo_L 2s linear 2.2s infinite'; document.getElementById('rocket_halo_L_fadeout').style.animation = 'rocket_halo_L_fadeout 2s linear 2.2s infinite'; document.getElementById('rocket_tail_L').style.animation = 'rocket_tail_L 2s linear 2.2s infinite'; document.getElementById('rocket_tail_S').style.animation = 'rocket_tail_S 2s linear 2.2s infinite'; // document.getElementById('rocket_halo_S').style.animation = 'rocket_halo_S 2s linear 2.2s infinite'; document.getElementById('rocket_halo_XS').style.animation = 'rocket_halo_XS 2s linear 2.2s infinite'; document.getElementById('rocket_block_left_1').style.animation = 'rocket_block_left_1 4s linear 3.7s infinite'; // document.getElementById('rocket_block_right_2').style.animation = 'rocket_block_right_2 4s linear 3.7s infinite'; // 数字 var i = 0, j = 0, k = 0; var windowWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidht; var numberOne = document.getElementById('index_bg_number_1'); var numberTwo = document.getElementById('index_bg_number_2'); var numberThree = document.getElementById('index_bg_number_3'); var rocketTimer = setInterval(function () { i += 11, j += 1, k += 2; if (j < 72 && windowWidth > 821) { numberOne.innerHTML = i; numberTwo.innerHTML = j; numberThree.innerHTML = k; } else { numberOne.innerHTML = 300; numberTwo.innerHTML = 99.999; numberThree.innerHTML = 300; clearInterval(rocketTimer) } }, 13); }); //火箭下Din字体引入 function loadDinFont(code) { var style = document.createElement('style'); style.type = 'text/css'; style.rel = 'stylesheet'; try { //for Chrome Firefox Opera Safari style.appendChild(document.createTextNode(code)); } catch (ex) { //for IE style.styleSheet.cssText = code; } var head = document.getElementsByTagName('head')[0]; head.appendChild(style); } var DinFont = "@font-face{font-family:'dinregular';src:url('" + baseSite + "fonts/DIN-Regular.eot');src:url('" + baseSite + "fonts/DIN-Regular.eot?#iefix') format('embedded-opentype'),url('" + baseSite + "fonts/DIN-Regular.woff') format('woff'),url('" + baseSite + "fonts/DIN-Regular.ttf') format('truetype'),url('" + baseSite + "fonts/DIN-Regular.svg#dinregular') format('svg');}" loadDinFont(DinFont); // })