Js implements horizontal shutter effect webpage switching animation effect method, js Shutter
This article describes how to implement horizontal shutter effect in JavaScript code. Share it with you for your reference. The specific analysis is as follows:
This is a simple but effective web page switch. After you click a new web page, the blue-and-white louddb lines will automatically switch until all the web pages are displayed completely. The Code is as follows:
Copy codeThe Code is as follows: <Head>
<Title> js webpage blinds dynamic switching effect </title>
<Style>
<! --
. Intro {
Position: absolute;
Left: 0;
Top: 0;
Layer-background-color: blue;
Background-color: blue;
Border: 0.1px solid blue
}
-->
</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
Temp [I]. height = window. innerHeight/8
Temp2 [I]. top = (I-1) * temp [I]. height
}
}
Else if (document. all ){
Var clipright = document. body. clientWidth, clipleft = 0
For (I = 1; I <= 8; I ++ ){
Temp [I] = eval ("document. all. I" + I + ". style ")
Temp [I]. width = document. body. clientWidth
Temp [I]. height = document. body. offsetHeight/8
Temp [I]. top = (I-1) * parseInt (temp [I]. height)
}
}
Function openit (){
Window. scrollTo (0, 0)
If (document. layers ){
For (I = 1; I <= 8; I = I + 2)
Temp [I]. right-= speed
For (I = 2; I <= 8; I = I + 2)
Temp [I]. left + = speed
If (temp [2]. left> window. innerWidth)
ClearInterval (stopit)
}
Else if (document. all ){
Clipright-= speed
For (I = 1; I <= 8; I = I + 2 ){
Temp [I]. clip = "rect (0" + clipright + "auto 0 )"
}
Clipleft + = speed
For (I = 2; I <= 8; I = I + 2 ){
Temp [I]. clip = "rect (0 auto" + clipleft + ")"
}
If (clipright <= 0)
ClearInterval (stopit)
}
}
Function gogo (){
Stopit= setInterval ("openit ()", 100)
}
Gogo ()
</Script>
</Body>
</Html>
I hope this article will help you design javascript programs.