Js implements horizontal shutter effect webpage switching animation effect method, js Shutter

Source: Internet
Author: User

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.