开发者社区 问答 正文

网页如何实现适合各种显示器

您是如何实现网页对于不同的显示器都能合适现实?

展开
收起
a123456678 2016-07-07 14:59:55 1633 分享 版权
1 条回答
写回答
取消 提交回答
  • function getPageSize() {
        var winW, winH;
        if(window.innerHeight) {// all except IE
            winW = window.innerWidth;
            winH = window.innerHeight;
        } else if(document.documentElement && document.documentElement.clientHeight) {// IE 6 Strict Mode
            winW = document.documentElement.clientWidth;
            winH = document.documentElement.clientHeight;
        } else if(document.body) {// other
            winW = document.body.clientWidth;
            winH = document.body.clientHeight;
        }
        return {
            WinW : winW,
            WinH : winH
        };
    }
    2019-07-17 19:52:51
    赞同 展开评论
问答地址: