I have always liked the special effects of those seven points on the Google homepage! In my spare time today, I found its originalCodeIt is too difficult to understand. Fortunately, it is relatively easy to find a simple code that imitates the special effects on the Google homepage, but there are still many points that you cannot understand. It seems that my Js + CSS water products are far behind each other. I 'd like to add it to my favorites and study it slowly. I hope I can understand it later ~~~
Run the following code:
<! Doctype HTML public "-// W3C // dtd xhtml 1.0 transitional // en" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<HTML xmlns = "http://www.w3.org/1999/xhtml">
<Head>
<Title> </title>
<Style type = "text/CSS">
<! --
Body {text-align: Center}
. Icon TD {width: 50px; Height: 37px; Background-image: URL (http://www.zzsky.cn/effect/images/2008901080950.gif )}
. Capt TD {Font: normal 11px verdana; padding: 2px 0}
. 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>
<Script language = "JavaScript">
Window. onload = function (){
VaR T = Document. getelementsbytagname ('table') [0];
VaR cs = T. Rows [1]. cells, Ct = T. Rows [0]. cells;
For (VAR I = 0; I <CS. length; I ++)
Cssani (CS [I], CT [I], 7 );
}
Function cssani (osrc, otarget, num, duration ){
VaR T = NULL, c = 1, D = 0, n = 0, I = math. Floor (duration || 300)/num );
VaR S = 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 )))
Return clearinterval (t), t = NULL;
Otarget. classname = S + (C + = D );
}, I );
};
}
</SCRIPT>
</Head>
<Body>
<Table>
<Tr class = "icon">
<TD class = "a F1"> </TD>
<TD class = "B F1"> </TD>
<TD class = "C F1"> </TD>
<TD class = "d F1"> </TD>
<TD class = "e F1"> </TD>
<TD class = "f F1"> </TD>
<TD class = "G F1"> </TD>
</Tr>
<Tr class = "Capt">
<TD> <a href = "#"> A </a> </TD>
<TD> <a href = "#"> B </a> </TD>
<TD> <a href = "#"> C </a> </TD>
<TD> <a href = "#"> d </a> </TD>
<TD> <a href = "#"> E </a> </TD>
<TD> <a href = "#"> F </a> </TD>
<TD> <a href = "#"> G </a> </TD>
</Tr>
</Table>
</Body>
</Html>