Google韩国首页图标动画效果

时间:2021-05-28

一个蛮漂亮的动画效果。是Google韩国首页上的。


原版:



<!DOCTYPEHTMLPUBLIC"-//W3C//DTDHTML4.01Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<metahttp-equiv="Content-Type"content="text/html;charset=gb2312">
<title>测试效果</title>
<styletype="text/css">
<!--
body{text-align:center}
table{border:1pxsolid#eeeeee;padding:3px0;border-bottom-width:5px}
.icontd{width:50px;height:37px;background-image:url(http://www.dnew.cn/attachment/1188099824_0.gif)}
.capttd{font:normal11pxverdana;padding:2px0}
.a{background-position-y:0px}
.b{background-position-y:-37px}
.c{background-position-y:-74px}
.d{background-position-y:-111px}
.e{background-position-y:-148px}
.f{background-position-y:-185px}
.g{background-position-y:-222px}
.f1{background-position-x:0px}
.f2{background-position-x:-51px}
.f3{background-position-x:-101px}
.f4{background-position-x:-153px}
.f5{background-position-x:-205px}
.f6{background-position-x:-257px}
.f7{background-position-x:-309px}
-->
</style>
<scriptlanguage="javascript">
window.onload=function(){
vartt=document.getElementsByTagName('table')[0];
varcs=tt.rows[1].cells,ct=tt.rows[0].cells;
for(vari=0;i<cs.length;i++)
cssAni(cs[i],ct[i],7);
}
functioncssAni(osrc,otarget,num,duration){
vart=null,c=1,d=0,n=0,i=Math.floor((duration||300)/num);
vars=otarget.className.replace(/.$/,''),r=/over/;
osrc.onmouseover=osrc.onmouseout=function(e){
n=r.test((e||event).type)?1:-1;
if(!t)t=setInterval(function(){
if((c==1||c==num)&&((d==n||c+n<1)||!(d=n)))
returnclearInterval(t),t=null;
otarget.className=s+(c+=d);
},i);
};
}
</script>
</head>
<body>
<table>
<trclass='icon'>
<tdclass='af1'></td>
<tdclass='bf1'></td>
<tdclass='cf1'></td>
<tdclass='df1'></td>
<tdclass='ef1'></td>
<tdclass='ff1'></td>
<tdclass='gf1'></td>
</tr>
<trclass='capt'>
<td><ahref='#;'>A</a></td>
<td><ahref='#;'>B</a></td>
<td><ahref='#;'>C</a></td>
<td><ahref='#;'>D</a></td>
<td><ahref='#;'>E</a></td>
<td><ahref='#;'>F</a></td>
<td><ahref='#;'>G</a></td>
</tr>
</table>
</body>
</html>

DIV版



<!DOCTYPEHTMLPUBLIC"-//W3C//DTDHTML4.01Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<metahttp-equiv="Content-Type"content="text/html;charset=gb2312">
<title>无标题文档</title>
<styletype="text/css">
<!--
body{text-align:center}
div{width:381px;border:1pxsolid#eeeeee;padding:3px0;border-bottom-width:5px}
label{display:block;float:left;width:50px;height:37px;background-image:url(http://www.dnew.cn/attachment/1188099824_0.gif)}
p{display:block;margin-TOP:-30PX;padding-top:30px;float:left;width:50px;height:auto;font:normal11pxverdana;cursor:pointer;}
.a{background-position-y:0px}
.b{background-position-y:-37px}
.c{background-position-y:-74px}
.d{background-position-y:-111px}
.e{background-position-y:-148px}
.f{background-position-y:-185px}
.g{background-position-y:-222px}
.f1{background-position-x:0px}
.f2{background-position-x:-51px}
.f3{background-position-x:-101px}
.f4{background-position-x:-153px}
.f5{background-position-x:-205px}
.f6{background-position-x:-257px}
.f7{background-position-x:-309px}
-->
</style>

<scriptlanguage="javascript">
window.onload=function(){
vartt=document.getElementsByTagName('div')[0];
varcs=tt.getElementsByTagName('label'),ct=tt.getElementsByTagName('p');

for(vari=0;i<cs.length;i++)
cssAni(ct[i],cs[i],7);
}
functioncssAni(osrc,otarget,num,duration){
vart=null,c=1,d=0,n=0,i=Math.floor((duration||300)/num);
vars=otarget.className.replace(/.$/,''),r=/over/;
osrc.onmouseover=osrc.onmouseout=function(e){
n=r.test((e||event).type)?1:-1;
if(!t)t=setInterval(function(){
if((c==1||c==num)&&((d==n||c+n<1)||!(d=n)))
returnclearInterval(t),t=null;
otarget.className=s+(c+=d);
},i);
};
}
</script>

</head>

<body>
<div>
<labelclass='af1'></label><labelclass='bf1'></label><labelclass='cf1'></label><labelclass='df1'></label><labelclass='ef1'></label><labelclass='ff1'></label><labelclass='gf1'></label>
<p>A</p><p>B</p><p>C</p><p>D</p><p>E</p><p>F</p><p>G</p>
</div>
</body>
</html>

声明:本页内容来源网络,仅供用户参考;我单位不保证亦不表示资料全面及准确无误,也不保证亦不表示这些资料为最新信息,如因任何原因,本网内容或者用户因倚赖本网内容造成任何损失或损害,我单位将不会负任何法律责任。如涉及版权问题,请提交至online#300.cn邮箱联系删除。

相关文章