View Full Version : Sound Rollover, continue sound until mouseout

11-18-2014, 04:57 AM
1) Script Title: DOM Image and Sound Rollover v4.0

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex15/domroll.htm

3) Describe problem: I love the rollover sound effect, but is there a way to make the sound continue (replay the sound file) for as long
as the mouse cursor is hovering over the image?
Need this for a "spooky" website where the Entrance page has a big old-fashioned animated "knocker". The sound file plays 3 deep knocks, but then the sound stops while the knocker's animation itself continues as long as the mouse cursor hovers over the knocker without clicking the link to enter the site. I know I could alternatively multiply the length of the sound files (mp3, wav, and ogg), but would prefer to keep them as small as possible, so making the 3-knock sound repeat would be the better option...IF it is possible.
Any help or advice would be greatly appreciated.

11-18-2014, 06:29 AM
Sure, try the below modified .js file. It sets the htmlaudio5 player so it loops while the mouse is over the target element.

11-18-2014, 12:10 PM
AWESOME!!! That's exactly what I needed, and works like a charm! Thanks a whole bunch!