I need help making a webpage. I need to set that page in fullscreen mode, so I have this JavaScript code:
我需要帮助制作网页。我需要在全屏模式下设置该页面,所以我有这个JavaScript代码:
var elem = document.getElementById("fulscreen");
var fs = document.getElementById("body");
elem.onclick = function()
{
req = fs.webkitRequestFullScreen;
req.call(fs);
}
function toggleFullScreen()
{
document.documentElement.requestFullscreen();
}
Where "fulscreen" is a ID of a button and "body" is the ID of the HTML tag then all the page can be in full screen, but there is the problem, the fullscreen mode is activated when i do a click in the button, and I need the webpage in fullscreen automatically... thanks :)
其中“fulscreen”是按钮的ID,“body”是HTML标签的ID,那么所有页面都可以全屏显示,但是有问题,当我点击按钮时会激活全屏模式,我需要自动全屏显示网页...谢谢:)
1 个解决方案
#1
http://sorcery.smugmug.com/2012/06/06/using-html5s-fullscreen-api-for-fun-and-profit/
Might help, though this function seems to be a morass of incompatibility.
可能有帮助,虽然这个功能似乎是不兼容的泥沼。
Generally, in js if you want something to happen as soon as the page has loaded, put a call to it in
通常,在js中,如果您希望在页面加载后立即发生某些事情,请在其中调用它
#1
http://sorcery.smugmug.com/2012/06/06/using-html5s-fullscreen-api-for-fun-and-profit/
Might help, though this function seems to be a morass of incompatibility.
可能有帮助,虽然这个功能似乎是不兼容的泥沼。
Generally, in js if you want something to happen as soon as the page has loaded, put a call to it in
通常,在js中,如果您希望在页面加载后立即发生某些事情,请在其中调用它