效果:
点击按钮全屏
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>
原文地址:https://www.cnblogs.com/wang1048076313/p/9467095.html
时间: 2024-10-30 03:49:16