文章分类 Classification
javascript火狐全屏并隐藏鼠标
稿件来源: 互联网 撰稿作者: 匿名 发表日期: 2014-10-24 阅读次数: 219 查看权限: 游客查看
javascript火狐全屏并隐藏鼠标
window.onload=function(){ var instructions = document.getElementById('button'); var havePointerLock = 'pointerLockElement' in document || 'mozPointerLockElement' in document || 'webkitPointerLockElement' in document; if ( havePointerLock ) { var element = document.body; instructions.addEventListener( 'click', function ( event ) { element.requestPointerLock = element.requestPointerLock || element.mozRequestPointerLock || element.webkitRequestPointerLock; if ( /Firefox/i.test( navigator.userAgent ) ) { var fullscreenchange = function ( event ) { if ( document.fullscreenElement === element || document.mozFullscreenElement === element || document.mozFullScreenElement === element ) { document.removeEventListener( 'fullscreenchange', fullscreenchange ); document.removeEventListener( 'mozfullscreenchange', fullscreenchange ); element.requestPointerLock(); } } document.addEventListener( 'fullscreenchange', fullscreenchange, false ); document.addEventListener( 'mozfullscreenchange', fullscreenchange, false ); element.requestFullscreen = element.requestFullscreen || element.mozRequestFullscreen || element.mozRequestFullScreen || element.webkitRequestFullscreen; element.requestFullscreen(); } else { element.requestPointerLock(); } }, false ); } else { alert('Your browser doesn\'t seem to support Pointer Lock API'); } }
关键词: firefox 编辑时间: 2014-10-24 11:42:46
0
高兴0
支持0
搞笑0
不解0
谎言0
枪稿0
震惊0
无奈0
无聊0
反对0
愤怒
0%(0)
0%(0)
- 暂无评论
文章图片 article Pictrue
网友评论