进入全屏和退出全屏

第一种:

//全屏
$("#fsc").on("click","#fullsc",function(){
    $(".judgementArea").addClass("fullscreenclass");
    $(".fullScreen,.page-header.navbar-fixed-top,.fullScreen").hide();
    var html = '<span id="exitfull">&nbsp;<span class="glyphicon glyphicon-fullscreen"></span><span id="close-fullsc">&nbsp;退出全屏</span></span>';
    $("#fsc").html(html);
    $("#fsc").data("data-fullscreen","1");
    var el = $("body")[0];
    var rfs = el.requestFullScreen || el.webkitRequestFullScreen || el.mozRequestFullScreen || el.msRequestFullscreen || el.oRequestFullscreen;      
    if(typeof rfs != "undefined" && rfs) {rfs.call(el)}
    return;
})
$("#fsc").on("click","#exitfull",function(){
	exitFullScreen();
})
function exitFullScreen(){
	var html = '<span id="fullsc">&nbsp;<span class="glyphicon glyphicon-fullscreen"></span><span id="close-fullsc">&nbsp;全屏</span></span>';
    $("#fsc").html(html);
    $(".fullScreen,.page-header.navbar-fixed-top").show();
    if($("#operateEdit").val()=='view'){
		$(".work_folw_cost").css("display","inline");
	}else{
		$(".work_folw_cost").css("display","none");
	}
    $(".judgementArea").removeClass("fullscreenclass");
    $("#fsc").data("data-fullscreen","0");
    if (document.exitFullscreen) {document.exitFullscreen();}  
    else if (document.mozCancelFullScreen) {  document.mozCancelFullScreen();  }  
    else if (document.webkitCancelFullScreen) {  document.webkitCancelFullScreen();  }  
    else if (document.msExitFullscreen) {  document.msExitFullscreen();  } 
    if(typeof cfs != "undefined" && cfs) {cfs.call(el)};
}
window.onresize = function(){
    if(!checkFull()){
    	exitFullScreen();
    }
}
function checkFull(){
    var explorer = window.navigator.userAgent.toLowerCase();
    if(explorer.indexOf('chrome')>0){//webkit
        if (document.body.scrollHeight === window.screen.height && document.body.scrollWidth === window.screen.width) {
            return true;
        } else {
            return false;
        }
    }else{//IE 9+  fireFox
        if (window.outerHeight === window.screen.height && window.outerWidth === window.screen.width) {
            return true;
        } else {
            return false;
        }
    }
}

.fullscreenclass{
    position: fixed;
    left:0;
    top:0;
    right:0;
    bottom:0;
    background-color: #fff;
    overflow:auto;
}

参考页面:

/pages/BudgetManagement/implemented/costSubjectTemplate.jsp  

  • 概预算管理-----预算执行情况填报

第二种:


$("#fsc").on("click","#fullsc",function(){
    $(".mini-toolbar").css({
        "width":"100%",
        "height":"100%"
    })
    $(".mini-menubutton,#dataExport,#multiEditButton,#release").hide();
    var html = '<span id="exitfull">&nbsp;<span class="glyphicon glyphicon-fullscreen"></span><span id="close-fullsc">&nbsp;退出全屏</span></span>';
    $("#fsc").html(html);
    var el = $("body")[0];
    var rfs = el.requestFullScreen || el.webkitRequestFullScreen || el.mozRequestFullScreen || el.msRequestFullscreen || el.oRequestFullscreen;      
    if(typeof rfs != "undefined" && rfs) {rfs.call(el)}
    return;
})

$("#fsc").on("click","#exitfull",function(){
    $(".mini-toolbar").css({
        "width":"95%",
        "height":"99%"
    })
    $(".mini-menubutton,#dataExport,#multiEditButton,#release").show();
    var html = '<span id="fullsc">&nbsp;<span class="glyphicon glyphicon-fullscreen"></span><span id="close-fullsc">&nbsp;全屏</span></span>';
    $("#fsc").html(html);
    if (document.exitFullscreen) {document.exitFullscreen();}  
    else if (document.mozCancelFullScreen) {  document.mozCancelFullScreen();  }  
    else if (document.webkitCancelFullScreen) {  document.webkitCancelFullScreen();  }  
    else if (document.msExitFullscreen) {  document.msExitFullscreen();  } 
    if(typeof cfs != "undefined" && cfs) {cfs.call(el)};
})
window.onresize = function(){
    if(!checkFull()){
        var html = '<span id="fullsc">&nbsp;<span class="glyphicon glyphicon-fullscreen"></span><span id="close-fullsc">&nbsp;全屏</span></span>';
        $("#fsc").html(html);
    }
}
function checkFull(){
    var isFull =  document.fullscreenEnabled || window.fullScreen || document.webkitIsFullScreen || document.msFullscreenEnabled;
    if(isFull === undefined) isFull = false;
    return isFull;

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值