Cool shake effect in javascript, how to trigger?

phasmatis_nox

[H]ard|Gawd
Joined
Jun 24, 2003
Messages
1,519
I saw this flash anim in which.... well... watch.

Now that you know what I'm talking about... I want to know how to do that. I found this code:
Code:
function shake() {
    if (parent.moveBy) {
        for (i = 15; i > 0; i--) {
            for (j = 2; j > 0; j--) {
                parent.moveBy(0,i);
                parent.moveBy(i,0);
                parent.moveBy(0,-i);
                parent.moveBy(-i,0);
            }
        }
    }
 }

That's apparently written to react to timings in the flash, as it does nothing on my site. Does anybody know how I can trigger this differently, such as on a link click or something? (Not all the time, that'd be annoying) I haven't learned much Javascript at all(yet!), so unfortunately I need to be spoonfed answers.

Thanks!
 
<a href="javascript:shake()">click</a>

i saw that effect once before and it was horrible, it just kept running endlessly so that you couldn't navigate the page. on your link however, it was actually done nicely
 
Paste the script into your page, and paste these links into the body of your page:
Code:
<a href="javascript: shake()">Shake 1</a><br>
<a href="http://www.hardocp.com" onclick="shake();">Shake 2</a>

Note: For some reason the "javascript" in the href of the first link is getting broken into "java script." Fix that when you paste.

Edit:
Tim beat me to it...
 
what's firebird have to do with it?

i'm using firebird and my window shook. While the video was rather dumb, it's timing and idea was great, implemented really well.

(sorry, i can't actually help with your problem)
 
Originally posted by Whatsisname
that thing is fucking obnoxious. <3 firebird.

Filtered it out in proxomitron a long time ago. Here's how my browser displays part of the first post in this thread for example:

Code:
                parent.pwned(0,i);
                parent.pwned(i,0);
                parent.pwned(0,-i);
                parent.pwned(-i,0);

Strangely, the pwned function doesn't do anything.

http://www.proxomitron.info/files/index.shtml
 
Yeah it does get anoying real quick I had a friend tell me he was gonna put it on his site about 2 months ago, I was like not if you want to continue getting 2000 hits a day... Noone likes you messing with their browsers.
 
At least it's not one of those things that has some text follow the mouse arround...
 
Originally posted by NickTheNut
what's firebird have to do with it?
Mozilla/Firebird has the handy feature of declaring with a series of checkboxes exactly what hold javascript is allowed on the browser. So that we don't have to deal with terrible scripts like this one.
 
I wouldnt like that sorta thing normally, but for that thing i reckon it fitted in nicely and didnt annoy me at all! :)
 
Back
Top