var checkFull;
//全屏预览
function fullScreen(el) {
checkFull=true;
$("#quanping").attr("src","images/suoxiao.png");
var rfs = el.requestFullScreen || el.webkitRequestFullScreen || el.mozRequestFullScreen || el.msRequestFullScreen,
wscript;
if(typeof rfs != "undefined" && rfs) {
rfs.call(el);
return;
}
if(typeof window.ActiveXObject != "undefined") {
wscript = new ActiveXObject("WScript.Shell");
if(wscript) {
wscript.SendKeys("{F11}");
}
}
}
//退出全屏
function exitFullScreen(el) {
checkFull=false;
$("#quanping").attr("src","images/fangda.png");
var el= document,
cfs = el.cancelFullScreen || el.webkitCancelFullScreen || el.mozCancelFullScreen || el.exitFullScreen,
wscript;
if (typeof cfs != "undefined" && cfs) {
cfs.call(el);
return;
}
if (typeof window.ActiveXObject != "undefined") {
wscript = new ActiveXObject("WScript.Shell");
if (wscript != null) {
wscript.SendKeys("{F11}");
}
}
}
var btn = document.getElementById('quanping');
var content = document.getElementById('mBox');
btn.onclick = function(){
if(checkFull){
exitFullScreen(content);
}else{
fullScreen(content);
}
}
js 全屏 退出全屏
最新推荐文章于 2024-08-30 17:06:55 发布