简单loading动画

没事闲的做了一个简单的loading动画 js就几行,却出了问题。。chrome下成功,但在Firefox下怎么改都显示不出来。。
提示window.event is not defined,在网上搜到了解决办法。原来FF跟不支持IE的JS标准,chrome却跟IE混的,太没节操了。 代码不支持IE因为这个动画是CSS3的。

DEMO:Loading Demo

HTML:

CSS:

#loading{
display:none; 
width:70px;
position:fixed;
top:50%;
left:50%;
margin-left:-40px;
} .blockG{ background-color:#FFFFFF; border:3px solid #8896fa; float:left; height:50px;
margin-left:7px; width:10px;
opacity:0.1;
-moz-animation-name:bounceG; -moz-animation-duration:1s; -moz-animation-iteration-count:infinite; -moz-animation-direction:linear; -moz-transform:scale(0.7); -webkit-animation-name:bounceG; -webkit-animation-duration:1s; -webkit-animation-iteration-count:infinite; -webkit-animation-direction:linear; -webkit-transform:scale(0.7); -ms-animation-name:bounceG; -ms-animation-duration:1s; -ms-animation-iteration-count:infinite; -ms-animation-direction:linear; -ms-transform:scale(0.7); -o-animation-name:bounceG; -o-animation-duration:1s; -o-animation-iteration-count:infinite; -o-animation-direction:linear; -o-transform:scale(0.7); animation-name:bounceG; animation-duration:1s;
animation-iteration-count:infinite;
animation-direction:linear;
transform:scale(0.7); } #blockG1{ -moz-animation-delay:0.39s; -webkit-animation-delay:0.39s; -ms-animation-delay:0.39s; -o-animation-delay:0.39s; animation-delay:0.39s; } #blockG2{ -moz-animation-delay:0.52s; -webkit-animation-delay:0.52s; -ms-animation-delay:0.52s; -o-animation-delay:0.52s; animation-delay:0.52s; }

blockG_3{ -moz-animation-delay:0.65s;

-webkit-animation-delay:0.65s; -ms-animation-delay:0.65s; -o-animation-delay:0.65s; animation-delay:0.65s; }
@-moz-keyframes bounceG{ 0%{ -moz-transform:scale(1.2); opacity:1} 100%{ -moz-transform:scale(0.7); opacity:0.1} }
@-webkit-keyframes bounceG{ 0%{ -webkit-transform:scale(1.2); opacity:1}
100%{ -webkit-transform:scale(0.7); opacity:0.1} }
@-ms-keyframes bounceG{ 0%{ -ms-transform:scale(1.2); opacity:1} 100%{ -ms-transform:scale(0.7); opacity:0.1} } @-o-keyframes bounceG{ 0%{ -o-transform:scale(1.2); opacity:1}
100%{ -o-transform:scale(0.7); opacity:0.1} }
@keyframes bounceG{ 0%{ transform:scale(1.2); opacity:1}
100%{ transform:scale(0.7); opacity:0.1} }

JS:

document.onclick = function(e)
{
src = e.target || window.event.srcElement; 
if (src.tagName=="A")
{ document.getElementById('loading').style.display="block";
setTimeout("document.getElementById('loading').style.display='none'",3000);
} }

Ruosen

Be a Geek, Do the right thing;