前端实现全屏功能
作者:
黏人的胶粒子 | 来源:发表于
2019-07-25 19:17 被阅读0次function openBig () {
# 想要全屏展示的模块包含class名content
var elem = document.querySelector('.content');
requestFullScreen(elem);
};
function requestFullScreen (elem) {
#兼容不同的浏览器
var requestMethod = elem.requestFullScreen || elem.webkitRequestFullScreen || elem.mozRequestFullScreen || elem.msRequestFullScreen;
if (requestMethod) {
requestMethod.call(elem)
} else if (typeof window.ActiveXObject !== 'undefined') {
#模拟F11 实现全屏
var wscript = new ActiveXObject('WScript.Shell')
if (wscript !== null) {
wscript.SendKeys('{F11}')
}
}
}
本文标题:前端实现全屏功能
本文链接:https://www.haomeiwen.com/subject/cnskrctx.html
网友评论