zoukankan      html  css  js  c++  java
  • js自定义获取浏览器宽高

    /**
    * @description js自定义获取浏览器宽高
    *
    * IE8 和 IE8 以下的浏览器不兼容
    * window.innerWidth
    * window.innerHeight
    *
    * html 头文件部加 <!doctype html> 表示启用标准模式
    * 标准模式 兼容所有浏览器
    *
    * document.body.clientWidth
    * document.body.clientHeight
    *
    * document.documentElement.clientWidth
    * document.documentElement.clientHeight
    *
    * @returns {0,height:0}
    */
    function getViewPortOffset(){
    if(window.innerWidth){
    return {
    window.innerWidth,
    height:window.innerHeight
    }
    }else{
    //混杂模式(兼容IE8以下)
    if(document.compatMode == 'BackCompat'){
    return{
    document.body.clientWidth,
    height:document.body.clientHeight
    }
    }else{
    return {
    document.documentElement.clientWidth,
    height:document.documentElement.clientHeight
    }
    }
    }
    }
  • 相关阅读:
    Postfix邮件服务
    Python
    LVS
    MFS
    Apache
    Zookeeper集群 + Kafka集群 + KafkaOffsetMonitor 监控
    shell 检测安装包
    shell ssh 批量执行
    shell 判断脚本参数
    bzoj 1500 修改区间 splay
  • 原文地址:https://www.cnblogs.com/M87-A/p/11166446.html
Copyright © 2011-2022 走看看