Js implements the animation Switching Effect of green and white vertical web page blinds and vertical blinds
The example in this article describes how js achieves green and white vertical webpage shutter animation switching. Share it with you for your reference. The specific analysis is as follows:
We have explained a webpage shutter switching animation effect, but it is a horizontal Louver. This is a vertical louver, and the code is basically the same:
Copy codeThe Code is as follows: <Head>
<Title> shutter page switching effect </title>
<Style>
<! --
. Intro {
Position: absolute;
Left: 0;
Top: 0;
Layer-background-color: green;
Background-color: green;
Border: 0.1px solid green
}
-->
</Style>
</Head>
<Body>
<Div id = "i1" class = "intro"> </div> <div id = "i2" class = "intro"> </div> <div id = "i3"
Class = "intro"> </div> <div id = "i4" class = "intro"> </div> <div id = "i5" class = "intro"> </div> <div
Id = "i6" class = "intro"> </div> <div id = "i7" class = "intro"> </div> <div id = "i8" class = "intro"> </div>
<Script language = "JavaScript1.2">
Var speed = 20
Var temp = new Array ()
Var temp2 = new Array ()
If (document. layers ){
For (I = 1; I <= 8; I ++ ){
Temp [I] = eval ("document. I" + I + ". clip ")
Temp2 [I] = eval ("document. I" + I)
Temp [I]. width = window. innerWidth/8-0.3
Temp [I]. height = window. innerHeight
Temp2 [I]. left = (I-1) * temp [I]. width
}
}
Else if (document. all ){
Var clipbottom = document. body. offsetHeight, cliptop = 0
For (I = 1; I <= 8; I ++ ){
Temp [I] = eval ("document. all. I" + I + ". style ")
Temp [I]. width = document. body. clientWidth/8
Temp [I]. height = document. body. offsetHeight
Temp [I]. left = (I-1) * parseInt (temp [I]. width)
}
}
Function openit (){
Window. scrollTo (0, 0)
If (document. layers ){
For (I = 1; I <= 8; I = I + 2)
Temp [I]. bottom-= speed
For (I = 2; I <= 8; I = I + 2)
Temp [I]. top + = speed
If (temp [2]. top> window. innerHeight)
ClearInterval (stopit)
}
Else if (document. all ){
Clipbottom-= speed
For (I = 1; I <= 8; I = I + 2 ){
Temp [I]. clip = "rect (0 auto +" + clipbottom + "0 )"
}
Cliptop + = speed
For (I = 2; I <= 8; I = I + 2 ){
Temp [I]. clip = "rect (" + cliptop + "auto )"
}
If (clipbottom <= 0)
ClearInterval (stopit)
}
}
Function gogo (){
Stopit= setInterval ("openit ()", 100)
}
Gogo ()
</Script>
</Body>
</Html>
I hope this article will help you design javascript programs.