Click here to Skip to main content
15,895,709 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
how to define an audio with no controls in jquery
and play it on mouse hover()?

any help appreciated!
Posted
Updated 14-Oct-13 7:25am
v2

Is HTML5 a viable option for you? Then use the element <audio>:
http://en.wikipedia.org/wiki/HTML5_Audio[^],
http://www.w3.org/TR/html5/embedded-content-0.html#the-audio-element[^],
http://www.w3.org/TR/webaudio/[^].

This element has the method play() which you can call in your handler of "hover": http://api.jquery.com/hover/[^].

—SA
 
Share this answer
 
leave second function(mouseout) blank so audio plays only when entering mouse into "a" tag

C#
$("a").hover(function(){
    var audio = $('<audio>', {
      autoPlay : 'autoplay',
      controls : 'controls'
    });
    addSource(audio, 'audio/ding.mp3');
    addSource(audio, 'audio/ding.wav');
    addSource(audio, 'audio/ding.ogg');
    },function(){

    });
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900