关于页面全屏化解决办法

效果:
 
点击按钮全屏
 
 
 
 
js :
fullscreen(ele) {
let element = document.getElementById(ele);
let requestMethod = element.requestFullScreen || element.webkitRequestFullScreen || element.mozRequestFullScreen || element.msRequestFullScreen;
console.log(requestMethod);
if (requestMethod) {
requestMethod.call(element);
} else if (typeof window.ActiveXObject !== "undefined") {
let wscript = new ActiveXObject("WScript.Shell");
if (wscript !== null) {
wscript.SendKeys("{F11}");
}
}

}
 
html:
<button type="primary"  onClick="fullscreen('full')" >全屏按钮</button>
 
 
 
 
posted @ 2018-08-13 11:32  我不喜欢高姿态的家伙  阅读(322)  评论(0编辑  收藏  举报