[英]To call Dofullscreen function immediately after page load
Following is the script 以下是脚本
<script type="text/javascript">
function DoFullScreen() {
var isInFullScreen = (document.fullScreenElement && document.fullScreenElement !== null) || // alternative standard method
(document.mozFullScreen || document.webkitIsFullScreen);
var docElm = document.documentElement;
if (!isInFullScreen) {
if (docElm.requestFullscreen) {
docElm.requestFullscreen();
}
else if (docElm.mozRequestFullScreen) {
docElm.mozRequestFullScreen();
//alert("Mozilla entering fullscreen!");
}
else if (docElm.webkitRequestFullScreen) {
docElm.webkitRequestFullScreen();
alert("Webkit entering fullscreen!");
}
}
}
</script>
HTML HTML
<body onload="DoFullScreen()">
<form id="form1" runat="server" >
<div id="div1">
<input id="bt1" type="button" value="button" />
Hello
</div>
</form>
</body>
I have tried 我努力了
$(window).load
$(document).ready(function(){ $("#bt1").load
-- it's not possible force a fullscreen if it's not triggered by a user action -如果不是由用户操作触发的,则不可能强制全屏显示
-- look at this - 看这个
on ready call your function 准备好调用您的函数
$(document).ready(function(){ $(文件)。就绪(函数(){
DoFullScreen(); DoFullScreen();
} }
You can do it using pure javascript
only like this: 您只能使用纯javascript
来做到这一点,如下所示:
<script type="text/javascript">
window.onload = function () {
// YOUR CODE STUFF
}
</script>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.