Use JS to change the page window from small to large

Source: Internet
Author: User
Tags window
js| Web page

There is no such experience, when you open a link, the browser window from small to large, rendering a gradual process. Below, we have to introduce the origin of this dynamic effect, we have to look carefully.

This program is based on the browser's available width and height, to calculate a central coordinate point, and then each time the window positioned to this point, and then calculate the corresponding window size, cycle 50 times, and eventually return to the browser to maximize the state.

Insert the following code between and and:

<script language= "JavaScript" >
<!--Begin
function expand () {
for (x = 0; x < × x + +) {
Window.moveto (Screen.availwidth *-(X-50)/screen.availheight *-(X-50)/100);
Defining a dynamic Window locator point
Window.resizeto (Screen.availwidth * x/50, Screen.availheight * x/50);
To define the dimensions of a dynamic window
}
Window.moveto (0,0);
Window.resizeto (Screen.availwidth, screen.availheight);
When the 50 changes are completed, the positioning window returns to (0,0), the size is maximized when the state.
}
End-->
</script>
<p>
<a href= "http://www.5dmedia.com" > click link to see Effect </a>

Here's a link to fill in your desired URL.

When we run, we can see the following effects:

At the beginning

At last



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.