【发布时间】: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