简体   繁体   中英

HTML5 Video: Hiding controls does not work in internet explorer, removeAttr, removeProp, etc

Trying to hide and show the video controls on hover enter / hover leave:

$('#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');
  }
})

Have tried everything. The ENTER and EXIT messages show properly, as expected, in Internet explorer, but the 'controls="true"' stays on the element and the controls stay visible on mouseleave! Any ideas why? Grumble.

document.getElementById("myVideo").controls = false;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM