【问题标题】:HTML5 Video: Hiding controls does not work in internet explorer, removeAttr, removeProp, etcHTML5 视频:隐藏控件在 Internet Explorer、removeAttr、removeProp 等中不起作用
【发布时间】:2016-09-24 03:39:28
【问题描述】:

尝试在悬停进入/悬停离开时隐藏和显示视频控件:

$('#content-video').hover(function(event) {
   if(event.type === "mouseenter") {
      console.log("ENTER");
      $(this).attr("controls", true);
  } else if(event.type === "mouseleave") {
      console.log("EXIT");
      $(this).attr("controls", false);
      $(this).prop("controls", false);
      $(this).removeAttr("controls");
      $(this).removeProp("controls");
      currentVideo.removeAttribute('controls');
  }
})

什么都试过了。 ENTER 和 EXIT 消息按预期在 Internet Explorer 中正确显示,但 'controls="true"' 保留在元素上,并且控件在 mouseleave 上保持可见!任何想法为什么?发牢骚。

【问题讨论】:

  • 哪个版本的IE?
  • 你可以试试 .control-bar { display: none;其中 .control-bar 是视频播放器中的控件类。另一种选择是 document.getElementById("myVideo").controls = false;
  • IE11。 document.getElementById 工作。谢谢拉多。
  • 没问题 Ryan,我把它作为答案发布了。

标签: javascript internet-explorer html5-video


【解决方案1】:
document.getElementById("myVideo").controls = false;

【讨论】:

    猜你喜欢
    • 2013-03-01
    • 2015-04-20
    • 2012-06-27
    • 2014-08-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-07-02
    相关资源
    最近更新 更多