全屏在 IE 中不起作用

Fullscreen not working in IE

所以我打开了滑块模块 运行 但是 Internet Explorer 11 没有响应全屏按钮。 Firefox 和 Chrome 工作正常。我在 Stack 上找到了这段代码,但仍然没有区别。有什么想法吗?

function toggleFullScreen() {
  if (!document.fullscreenElement &&    // alternative standard method
      !document.mozFullScreenElement && !document.webkitFullscreenElement) {  // current working methods
    if (document.documentElement.requestFullscreen) {
      document.documentElement.requestFullscreen();
    } else if (document.documentElement.mozRequestFullScreen) {
      document.documentElement.mozRequestFullScreen();
    } else if (document.documentElement.webkitRequestFullscreen) {
      document.documentElement.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT);
    } else if (elem.msRequestFullscreen) {
            elem.msRequestFullscreen();
    }


  } else {
    if (document.cancelFullScreen) {
      document.cancelFullScreen();
    } else if (document.mozCancelFullScreen) {
      document.mozCancelFullScreen();
    } else if (document.webkitCancelFullScreen) {
      document.webkitCancelFullScreen();
    } else if (document.msExitFullscreen) {
            document.msExitFullscreen();
        }
  }
}

 </script>

很抱歉,如果这个问题已经得到回答。我还没有找到解决方案。

据此site IE 不支持全屏API。似乎也没有关于这是否会被 IE11 支持的信息。

根据 MDN 的 article on fullscreen 看来,对于大多数浏览器而言,此技术仍处于试验阶段。

你也可以试试这个

Internet Explorer full screen mode?

Set window to fullscreen (REAL fullscreen; F11 functionality) by javascript

<script type="text/javascript">
    function max() {
        var wscript = new ActiveXObject("Wscript.shell");
        wscript.SendKeys("{F11}");
    }
</script>

如果您真的想在 Internet Explorer 中全屏....请尝试在 jquery 中将滑块的宽度和高度设置为 100%。