Javascript 全屏按钮移动设备
我的网站上有一个嵌入式游戏 我已经用JavaScript创建了一个全屏按钮,它可以在桌面上运行;但当我按下Galaxy S6上的按钮时,屏幕不是全屏的,但不知何故它认为这是因为我不能再滚动了 游戏在iFrame中,所以我给了它一个ID来与按钮进行通信 这是我的密码:Javascript 全屏按钮移动设备,javascript,jquery,html,mobile,fullscreen,Javascript,Jquery,Html,Mobile,Fullscreen,我的网站上有一个嵌入式游戏 我已经用JavaScript创建了一个全屏按钮,它可以在桌面上运行;但当我按下Galaxy S6上的按钮时,屏幕不是全屏的,但不知何故它认为这是因为我不能再滚动了 游戏在iFrame中,所以我给了它一个ID来与按钮进行通信 这是我的密码: <iframe id="game" style="width:337px;height:600px;border:0;" allowfullscreen="true" msallowfu
<iframe
id="game"
style="width:337px;height:600px;border:0;"
allowfullscreen="true"
msallowfullscreen="true"
mozallowfullscreen="true"
webkitallowfullscreen="true"
sandbox="allow-same-origin allow-popups allow-scripts allow-pointer-lock allow-orientation-lock allow-popups"
src="https://games.scirra.net/games/1787/">
</iframe>
<a class="btn color-1"
onclick="makeFullscreen('game')">
Volledig scherm!
</a>
<script>
function makeFullscreen(id){
var el = document.getElementById(id);
if (el.requestFullScreen ) el.requestFullScreen();
else if (el.webkitRequestFullScreen) el.webkitRequestFullScreen();
else if (el.mozRequestFullScreen ) el.mozRequestFullScreen();
}
沃勒迪格·谢尔姆!
函数makeFullscreen(id){
var el=document.getElementById(id);
如果(el.requestFullScreen)el.requestFullScreen();
else if(el.webkitRequestFullScreen)el.webkitRequestFullScreen();
else if(el.mozRequestFullScreen)el.mozRequestFullScreen();
}
在我手机上的chrome浏览器上进行了测试。在那里,它似乎工作得很好。我认为这与新的android internet 4浏览器有关?我在JSFIDLE上用chrome进行了测试,我感到困惑,但根本不起作用。你可能想看看这个,tho:这是可行的,但不是我想要的。我试着通过按下按钮让iframe覆盖整个屏幕,这是怎么回事?我真的很喜欢这个设置,但是这个按钮在移动浏览器中不再起作用了,在JSFIDLE中效果很好。在我的移动设备上,它不会更改style=”“标签