JavaScript Crazy Window Zoomer
I really don’t know how this would be useful, but it might teach you a couple of things about how to use the browser window functions and properties.
The following function resizes the browser window to nothing and then gradually increases this to full screen in a series of steps, at each step the window is moved so that it is in the middle of the screen. This in effect makes it look like the browser window is zooming in.
function warpSpeedWindow(){
for(i = 0;i < 50;i++){
window.moveTo(screen.availWidth * -(i - 50) / 100, screen.availHeight * -(i - 50) / 100);
window.resizeTo(screen.availWidth * i / 50, screen.availHeight * i / 50);
}
window.moveTo(0,0);
window.resizeTo(screen.availWidth, screen.availHeight);
}
You can call this function on the page load by using the following:
<script type="text/javascript" language="javascript">warpSpeedWindow();</script>
This is a fun little thing to do and should be used for educational purposes only. Please refrain from doing this on a live site. Any user who sees this effect is likely to think that the site is very unprofessional and go elsewhere.
Comments
Comment from Jamie Bicknell
Date: August 26, 2008, 10:00 pm
Also, you can do this to any site, even if you are not the owner. All you need to do is insert the javascript code into the URL address bar and it will work on the current site.
EG: (copy and paste this into your Address bar, but remember to have it all on ONE line!!!)
javascript:for(i = 0;i < 50;i++){window.moveTo(screen.availWidth * -(i - 50) / 100, screen.availHeight * -(i - 50) / 100);window.resizeTo(screen.availWidth * i / 50, screen.availHeight * i / 50);}window.moveTo(0,0);window.resizeTo(screen.availWidth, screen.availHeight);
Comment from Tech
Date: August 27, 2008, 7:51 am
thanks for the bookmarklet. I’ve given it a go and it works!
Write a comment