# Shaking Browser Window

**URL:** <https://forum.kirupa.com/t/shaking-browser-window/57220>\
**Category:** web dev\
**Created:** [July 11, 2004, 3:04pm UTC](https://forum.kirupa.com/t/shaking-browser-window/57220 "2004-07-11T15:04:48Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nick](https://avatars.discourse-cdn.com/v4/letter/n/f9ae1b/32.png) [@Nick](https://forum.kirupa.com/u/Nick)\
**Post date:** [July 11, 2004, 3:04pm UTC](https://forum.kirupa.com/t/shaking-browser-window/57220/1 "2004-07-11T15:04:48Z")

</div>

Hey guys, I have a question. How can you make the window of an interent browser shake by itself as in this link: [http://www.ebaumsworld.com/dubdub2.html](http://www.ebaumsworld.com/dubdub2.html) ?

Thanks in advance.

-Nick

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 11, 2004, 7:12pm UTC](https://forum.kirupa.com/t/shaking-browser-window/57220/2 "2004-07-11T19:12:06Z")

</div>

LoL, i’ve never seen the browser shake method used like that… I like it! Anywho, here is what you get when you do a search on K:

[http://www.kirupaforum.com/forums/search.php?searchid=71990](http://www.kirupaforum.com/forums/search.php?searchid=71990)

I’m sure you’ll find what you need, I’ve used it once b4 and found it here.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 11, 2004, 8:22pm UTC](https://forum.kirupa.com/t/shaking-browser-window/57220/3 "2004-07-11T20:22:36Z")

</div>

thanks for the link! anyway I figured it out and it’s very easy to do. Here’s how for anyone else that is interested.

1. insert this code under the \<head\> tag of your page’s html:

\<SCRIPT LANGUAGE=“JavaScript1.2”\>  
function shake\_xy(n) {  
if (self.moveBy) {  
for (i = 10; i \> 0; i–) {  
for (j = n; j \> 0; j–) {  
self.moveBy(0,i);  
self.moveBy(i,0);  
self.moveBy(0,-i);  
self.moveBy(-i,0);  
}  
}  
}  
}  
function shake\_x(n) {  
if (self.moveBy) {  
for (i = 10; i \> 0; i–) {  
for (j = n; j \> 0; j–) {  
self.moveBy(i,0);  
self.moveBy(-i,0);  
}  
}  
}  
}  
function shake\_y(n) {  
if (self.moveBy) {  
for (i = 10; i \> 0; i–) {  
for (j = n; j \> 0; j–) {  
self.moveBy(0,i);  
self.moveBy(0,-i);  
}  
}  
}  
}  
//–\>  
\</SCRIPT\>

1. in flash,  
a) just pick a frame  
b) use the getURL option  
c) for the URL insert “javascript:shake\_xy(n)” (no quotes)

shake\_xy(n) : Shakes the screen in x and y directions, n is a size number, bigger means more shaking!  
shake\_x(n) : Shakes the screen in the x direction!  
shake\_y(n) : Shakes the screen in the y direction!

1. Just insert your .swf in the page with the code!

## Helpful Sites:

[http://www.flashkit.com/tutorials/Special\_Effects/Shaking\_-Mark\_Fen-7/index.php](http://www.flashkit.com/tutorials/Special_Effects/Shaking_-Mark_Fen-7/index.php)

[http://www.permadi.com/tutorial/jsquake/](http://www.permadi.com/tutorial/jsquake/)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 11, 2004, 11:09pm UTC](https://forum.kirupa.com/t/shaking-browser-window/57220/4 "2004-07-11T23:09:25Z")

</div>

The basic answer to this question is…YOU DON’T!!!

Next to popups and Flash boxes that take up your entire screen when you mouseover, these are one of the most rubbish effects on the web. Nobody cares!

Plus, if someone tries to scroll while it’s shaking like that, you get caught in an endless loop of errors! Just try it on your eBaum link above.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 11, 2004, 11:15pm UTC](https://forum.kirupa.com/t/shaking-browser-window/57220/5 "2004-07-11T23:15:25Z")

</div>

Actually, I think it’s a very catchy and surprising effect. It really depends on how you use it. I’m going to apply it so it shakes the browser window after an explosion and I think it would enhance the effect.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 11, 2004, 11:22pm UTC](https://forum.kirupa.com/t/shaking-browser-window/57220/6 "2004-07-11T23:22:52Z")

</div>

OK, apologies…  
After an explosion on your page, it might be kinda cool but just don’t milk it as far as the duration goes!

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 16, 2004, 7:29am UTC](https://forum.kirupa.com/t/shaking-browser-window/57220/7 "2004-07-16T07:29:08Z")

</div>

[http://www.gorillaglue.com](http://www.gorillaglue.com) is a nice example of well window shaking.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 16, 2004, 7:44am UTC](https://forum.kirupa.com/t/shaking-browser-window/57220/8 "2004-07-16T07:44:38Z")

</div>

That music page was by far the best use of the shake browser code I’ve seen

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 16, 2004, 10:36am UTC](https://forum.kirupa.com/t/shaking-browser-window/57220/9 "2004-07-16T10:36:19Z")

</div>

if you scroll it stops shaking nothing else
