小编典典

onclick进入全屏

javascript

我正在为即将推出的Chrome网上商店创建一个网络应用。有没有办法模拟F11被按下?还是简单地使当前窗口全屏显示的命令?


阅读 355

收藏
2020-05-01

共1个答案

小编典典

var elem = document.getElementById("myvideo");
    if (elem.requestFullscreen) {
      elem.requestFullscreen();
    } else if (elem.msRequestFullscreen) {
      elem.msRequestFullscreen();
    } else if (elem.mozRequestFullScreen) {
      elem.mozRequestFullScreen();
    } else if (elem.webkitRequestFullscreen) {
      elem.webkitRequestFullscreen();
    }
2020-05-01