HTML5全屏代码片段
fullScreen:function(){ var fullTarget=$(".fullScreen")[0]; if(fullTarget.webkitRequestFullScreen){ fullTarget.webkitRequestFullScreen(); } else if(fullTarget.mozRequestFullScreen){ fullTarget.mozRequestFullScreen(); } else if(fullTarget.requestFullscreen){ fullTarget.requestFullscreen(); } else if(navigator.userAgent.indexOf('MSIE')>-1){ $("body").removeClass('fullScreen'); var href=document.location.href; if(href.indexOf("fullscreen")>-1) window.open(href,"","fullscreen,scrollbars=no,Resizable=no"); else window.open(href+"fullscreen","","fullscreen,scrollbars=no,Resizable=no"); } }, existFullScreen:function(){ if(document.webkitIsFullScreen){ document.webkitCancelFullScreen(); } else if(document.mozFullScreen){ document.mozCancelFullScreen(); } else if(document.fullScreen){ document.cancelFullScreen(); } else{ self.close(); } }, fullScreenListen:function(){ $(document).on('webkitfullscreenchange mozfullscreenchange fullscreenchange',function(){ if (document.mozFullScreen ||document.webkitIsFullScreen ){ $("body").addClass('fullScreen'); } else{ $("body").removeClass('fullScreen'); } }); },
本文由用户 jopen 自行上传分享,仅供网友学习交流。所有权归原作者,若您的权利被侵害,请联系管理员。
转载本站原创文章,请注明出处,并保留原始链接、图片水印。
本站是一个以用户分享为主的开源技术平台,欢迎各类分享!