参考链接: https://www.cnblogs.com/yiven/p/7885528.html.
我这里需要只要谷歌的浏览器所以简写了
webkitRequestFullscreen只能设置body全屏所以设置div的样式占满body的思路
点击按钮 编写并同时添加设置div的样式
var doc = document.documentElement;
doc.webkitRequestFullscreen();
position:fixed;
width: 100%!important;
height: 100%!important;
background: white;
left:0;
right:0;
top:0;
bottom:0;
最后监听f11退出事件删除样式
//监听退出全屏事件
window.onresize = function() {
if (!checkFull()) {
$(".body2").removeClass("Screen");
$(".body3").removeClass("Screen");
}
}
结束