PDA

View Full Version : Shaking faster



sakalodi
09-05-2006, 01:36 PM
1) Script Title: Shake Image Script

2) Script URL (on DD):
http://www.dynamicdrive.com/dynamicindex4/shake.htm

3) Describe problem:
When using this script with with multiple images without any space in between, the shaking goes faster and faster. Probably the setTimeout is adding up or something??

Is there a way to "update" this script so that the shaking is going the same speed all the time? The problem is also there on the script-url. Just move your mouse from one pic to another a few times.

Thanks.
Sandy

mburt
09-05-2006, 02:04 PM
Hmm... It appears there needs to be a clearTimeout() somewhere in there.

sakalodi
09-05-2006, 02:09 PM
Hi Mike,

Thanks.

The setTimeout is in function rattleimage...

setTimeout("rattleimage()",50)

Gr, Sandy

mburt
09-05-2006, 02:37 PM
Make the setTimeout() a variable:


var time = setTimeout("rattleimage()",50)

and set the image's onmouseout event handler like this:


<img onmouseout="clearTimeout(time)">

blm126
09-05-2006, 10:48 PM
var time = setTimeout("rattleimage()",50)

will probably need to be just


time = setTimeout("rattleimage()",50)

mburt
09-05-2006, 11:38 PM
Meh... Lol :D

sakalodi
09-06-2006, 05:54 AM
Yes, it works!
Thank you, thank you! :)