HTML5 视频:隐藏控件在 Internet Explorer、removeAttr、removeProp 等中不起作用
HTML5 Video: Hiding controls does not work in internet explorer, removeAttr, removeProp, etc
尝试在悬停进入/悬停离开时隐藏和显示视频控件:
$('#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 上保持可见!任何想法为什么?发牢骚。
document.getElementById("myVideo").controls = false;
尝试在悬停进入/悬停离开时隐藏和显示视频控件:
$('#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 上保持可见!任何想法为什么?发牢骚。
document.getElementById("myVideo").controls = false;