stop already playing sound with javascript -


i have following function play sound when div hovered

function playsound() {     var snd = new audio();     snd.src = 'snd/ring.mp3';     snd.play(); }  // play sound on mouseover $('.navigation a').hover(function () {     playsound();     $(this).find('img').animaterotate(-360, 1000); }); 

the problem when mouseleaves link, replays sound again. want play once , when mouse leaves sounds should stopped. how can done ?

the hover() function addds handlers mouseenter , mouseleave.

you want handle mouseenter only.


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -