• 关于浏览器的可视大小


    ie6之前的版本,窗口的可视大小body元素的大小。html标记是隐藏的。

    而对于现代浏览器,窗口的可视大小是html元素的大小。html、body元素对应到javascript中分别为document.documentElement、document.body.

    因此ie6以后的版本,ff,safari的可视宽度和高度为:

    var windowWidth = document.documentElement.clientWidth || document.body.clientWidth;
    var windowHeight = document.documentElement.clientHeight || document.body.clientHeight;

    opera则以body元素计算窗口的可视大小:

    windowWidth = document.body.clientWidth;
        windowHeight 
    = document.body.clientHeight;

    因此,计算浏览器的可视大小应该表示为:

    var windowWidth = document.documentElement.clientWidth || document.body.clientWidth;
    var windowHeight = document.documentElement.clientHeight || document.body.clientHeight;

    //标准下,opera的窗口的可是高度为document.body.clientWidth
    if (window.opera)
    {
        windowWidth 
    = document.body.clientWidth;
        windowHeight 
    = document.body.clientHeight;
    }
  • 相关阅读:
    python wsdl connection refused 111
    我要学算法
    linux 定时任务
    mysql语句
    Firefox配置Fiddler
    windows下安装spynner
    做一个完整的项目需要技能
    快速排序
    《实时控制软件设计》总结
    asp实现在微信jsdk分享从a页面跳转到b页面然后分享后点开又回a页面
  • 原文地址:https://www.cnblogs.com/wangxiang/p/1258298.html
Copyright © 2020-2023  润新知