HTML5视频控件(静音按钮) [英] HTML5 Video Controls (Mute Button)
本文介绍了HTML5视频控件(静音按钮)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
$(".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");
}
});
尝试获取声音图标.sound以静音或取消静音html5视频.intro-电影点击时。
Trying to get the sound icon ".sound" to mute or unmute the html5 video ".intro-movie" when clicked.
推荐答案
我试过可能的例子,我终于自己做了。它完美无缺。
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)";
}
}
这篇关于HTML5视频控件(静音按钮)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文