Reputation: 27
$(".sound").click(function() {
if ($(".intro-movie").prop('muted', true)) {
$(".intro-movie").prop('muted', true);
$(".sound").addClass("muted");
} else {
$(".intro-movie").prop('muted', false);
$(".sound").removeClass("muted");
}
});
Trying to get the sound icon ".sound" to mute or unmute the html5 video ".intro-movie" when clicked.
Upvotes: 0
Views: 5328
Reputation: 11
I tried may examples, and I finally made it myself. It works perfectly.
function mute() {
if(myaudio.muted) {
myaudio.muted=!myaudio.muted;
document.getElementById("volume").style.backgroundImage = "url(resources/vol.png)";
}else{
myaudio.muted=!myaudio.muted;
document.getElementById("volume").style.backgroundImage = "url(resources/mute.png)";
}
}
Upvotes: 1