Good Evening everyone, im somehow stuck on a simple Problem, but just can't figuere out how to solve it. Im playing around the first time with jquery.
Now on mousenter it plays the audiofile just fine, but i tried to implement a on mouseout function to stop the audio file from playing. I simple can't get it to work.
I hope someone can help me out that would be great :)
<div class="buttonmit2ani">
<audio id="beep-one" preload="auto">
<source src="audio/baby.mp3"></source>
<source src="audio/beep.ogg"></source>
Your browser isn't invited for super fun time.
</audio>
<script>
var beepOne = $("#beep-one")[0];
$(".buttonmit2ani")
.mouseenter(function() {
beepOne.play();
);
</script>
</div>
Try This:
var beepOne = $("#beep-one")[0];
$('.buttonmit2ani').mouseover(function(){
beepOne.play();
}).mouseout(function(){
beepOne.stop(); // need to write this method or .pause()
});