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

Add new comment

CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image.
French