Links

Lists

Latest Updates

Ruby On Rails List
Python list
Advanced Java
The JavaScript List
Apache Users
Full Disclosure
Linux Security

Search the archives!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Javascript] Image rotation.


  • From: paul at novitskisoftware.com (Paul Novitski)
  • Subject: [Javascript] Image rotation.
  • Date: Tue Feb 14 23:32:22 2006

At 12:05 PM 2/14/2006, Shawn Milo wrote:
>If the setTimout() has already been called, is there a way to cancel 
>it, or would I have to just change a flag or something when a 
>thumbnail is clicked, and know to reverse the change?

How about this:  declare a RotationCountdown variable initialized to, 
say, 10.  Each time your primary timeout wakes up, it decrements 
RotationCountdown.  When it decrements RotationCountdown to zero, it 
sets it back to 10 and rotate the thumbnails.

Other events can set RotationCountdown as well.  Each keypress and 
mousemove sets it back to 10 to suspend rotation for N seconds after 
the last user action.  Clicking on a thumbnail halts rotation (by 
setting RotationCountdown to a negative number?), while completing a 
large image load resets it to zero to begin rotation again.

Isn't it wonderful the way the simplest bud can blossom into a mighty project?

P.