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
Post a Comment