Search code examples
javascripthtmlaudiohovermp3

Stop play sound when not hovering the picture


I want the sound to stop play when you are not active hovering the picture. What is the easiest way to do this? Thanks in advance!

imgarr[i].onmouseout=function(){
    this.setAttribute('src',this.getAttribute('xsrc'))
            }
        })()
    }

It is more clearly showed in my jsfiddle example,
http://jsfiddle.net/3tnGL/

Hope you understand.

Sebastian


Solution

  • This seems to work fine

    imgarr[i].onmouseout=function(){
        this.setAttribute('src',this.getAttribute('xsrc'))
        html5audio.pause()
    }
    

    I am using FireFox