使用javascript在onload上触发F11键事件 [英] F11 key event fire on onload using javascript
本文介绍了使用javascript在onload上触发F11键事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有办法解雇 F11 关键事件onload并在执行某些操作后自动退出。
Is there any way to fire F11 key event onload and automatic exit from that after some action.?
推荐答案
将以下代码放在加载事件上:
Put your following code on your load event:
if ((document.fullScreenElement && document.fullScreenElement !== null) || (!document.mozFullScreen && !document.webkitIsFullScreen)) {
if (document.documentElement.requestFullScreen) {
document.documentElement.requestFullScreen();
} else if (document.documentElement.mozRequestFullScreen) {
document.documentElement.mozRequestFullScreen();
} else if (document.documentElement.webkitRequestFullScreen) {
document.documentElement.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT);
}
} else {
if (document.cancelFullScreen) {
document.cancelFullScreen();
} else if (document.mozCancelFullScreen) {
document.mozCancelFullScreen();
} else if (document.webkitCancelFullScreen) {
document.webkitCancelFullScreen();
}
}
它可以重新调整窗口大小设备屏幕。
It will able to re-size of your window screen to device screen.
这篇关于使用javascript在onload上触发F11键事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文