lundi 5 janvier 2015

Play sound on .show

I have an element (#coupontooltip) which displays after 5 seconds when the page is loaded. I would like a sound to play at the same time that the div shows.


This is the code I have tried and it doesnt seem to be working. The audio is hosted on the server and present in the page.



<audio id="my_audio4">

<source src="img/done.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>


<script>

$(window).load(function () {
$(".coupontooltip").show(5000, function(){
("#my_audio4").get(0).play();
});
});


</script>

Aucun commentaire:

Enregistrer un commentaire