从全屏退出不工作? [英] Exit from full screen not working?
问题描述
我正在使用Iframe去全屏。问题是如何关闭按钮点击全屏?
我使用这个代码:
<$ p $函数exitfs(){
if(document.cancelFullScreen){
document.cancelFullScreen();
} else if(document.mozCancelFullScreen){
document.mozCancelFullScreen();
} else if(document.webkitCancelFullScreen){
document.webkitCancelFullScreen();
$ b如果我通过萤火虫控制台运行,不能用点击事件绑定?
function fullscreen(keys){
它为我工作。希望能帮到一些...
var f = e('newIfrane' );
if(keys){
if(f.mozRequestFullScreen){
f.mozRequestFullScreenWithKeys();
} else if(f.webkitRequestFullScreen){
f.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT);
}
} else {
if(f.mozRequestFullScreen){
f.mozRequestFullScreen();
} else if(f.webkitRequestFullScreen){
f.webkitRequestFullScreen();
$ b code
$ b $ p $调用这个函数就像fullscreen(false);
注意:Iframe正以全屏模式加载相同的页面。
在Page中有一个图像点击的图像我打电话 exitfs()。
我没有得到问题是什么?
Thanks ...解决方案正如 Passerby c $ c> parent.exitfs();
I'm working on a application which works in full screen mode. I'm using a Iframe to go to fullscreen. the problem is how to close that fullscreen on button click?
I'm using this code:
function exitfs(){ if (document.cancelFullScreen) { document.cancelFullScreen(); } else if (document.mozCancelFullScreen) { document.mozCancelFullScreen(); } else if (document.webkitCancelFullScreen) { document.webkitCancelFullScreen(); } }
It works fine if i run it through firebug console but not works when bind with click event?
function fullscreen(keys) { var f = e('newIfrane'); if (keys) { if (f.mozRequestFullScreen) { f.mozRequestFullScreenWithKeys(); } else if (f.webkitRequestFullScreen) { f.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT); } } else { if (f.mozRequestFullScreen) { f.mozRequestFullScreen(); } else if (f.webkitRequestFullScreen) { f.webkitRequestFullScreen(); } } }
calling this function like
fullscreen(false);
Note: Iframe is loading the same page in fullscreen mode. In Page there is a Image on click of that image I'm calling exitfs().
I'm not getting what is the problem? Thanks...
解决方案as suggested by Passerby I tried with the
parent.exitfs();
and it worked for me. hope it will help someOne...这篇关于从全屏退出不工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!