是否有任何JavaScript函数可以告诉我当前的 [英] Is there any javascript function/s that will tell me if the current

查看:60
本文介绍了是否有任何JavaScript函数可以告诉我当前的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有任何JavaScript函数可以告诉我当前的
浏览器窗口是否处于全屏模式?

Is there any javascript function/s that will tell me if the current
browser window is in full screen mode or not?

推荐答案

尝试以下操作:

必须在页面完全加载后使用,以便在页面onload或加载完成后在函数中使用.

Try this:

Must be used after the page is fully loaded, so in page onload or used in a function after loading is complete.

function IsFullScreen( )
{
      // Variables
      var intScreenHeight = window.screen.height;
      var intBodyOffSet = document.body.offsetHeight;
      var intFullScreenDifference = 26;
      var blnIsFullScreen = false; // Assume No
      // Does the Screen Height - the Body offset = Full Screen Difference
      if( ( intScreenHeight - intBodyOffSet ) == intFullScreenDifference )
      {
            // Yes, were full screen
            blnIsFullScreen = true;
      }
      // Return
      return blnIsFullScreen;
}

</script>

<html>
      <body onload="alert( IsFullScreen( ) );">
      <br>
      <br>
      <br>
      <br>
      <br>
      <br>
      <br>
      <br>
      <br>
      <br>
      </body>
</html>



祝你好运!



Good luck!


这篇关于是否有任何JavaScript函数可以告诉我当前的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆