【问题标题】:HTML5 Video Controls (Mute Button)HTML5 视频控件(静音按钮)
【发布时间】:2013-11-10 21:44:19
【问题描述】:
$(".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-movie”。

【问题讨论】:

  • 也许你的if ($(".intro-movie").prop('muted', true)) 必须是if ($(".intro-movie").prop('muted', false))。现在看来: if(muted) then mute else unmute
  • 如果 statemet 应该改变。而且这个Q是类似Q的重复1st link2nd link

标签: javascript jquery html video


【解决方案1】:

我尝试了可能的例子,最后我自己做了。效果很好。

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)";
}

}

【讨论】:

    猜你喜欢
    • 2014-07-13
    • 1970-01-01
    • 2011-12-09
    • 1970-01-01
    • 2020-08-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多