sd


Play Audio on :hover

We're going to use HTML5 here, no Flash. We'll need an audio element with both MP3 (WebKit, IE) and OGG (Firefox, Opera).


<audio controls preload="auto">
	<source src="http://harissa.com/news/sites/default/files/91.mp3" controls></source>
	<source src="audio/beep.ogg" controls></source>
	onmouseover="EvalSound('sound1')" onmouseout="StopSound('sound1')"
Your browser isn't invited for super fun audio time.
</audio>

We're using jQuery in this demo to make selecting things and events easier, but the .play() function is native. You probably wouldn't show the audio element, that's for demo purposes only, just remove the control attribute to not show anything.

Cloned <audio>, one for each menu item

Smoothest but not perfect.

 

 

onmouseout="StopSound('mySound')">Hover Over Me To Play

Ajouter un commentaire

CAPTCHA
Cette question est pour verifier que vous etes une personne et non une machine et ce, pour empecher tout envoi de spam
Image CAPTCHA
Saisir les caractères affichés dans l'image.
Français