zoukankan      html  css  js  c++  java
  • JS常用公共方法 获取弹出层合适的宽高

    
    function getExplorer() {
    	var explorer = window.navigator.userAgent;
    	if (isIE()) {
    		return "IE";
    	}
    	//firefox
    	else if (explorer.indexOf("Firefox") >= 0) {
    		return "Firefox";
    	}
    	//Chrome
    	else if (explorer.indexOf("Chrome") >= 0) {
    		return "Chrome";
    	}
    	//Opera
    	else if (explorer.indexOf("Opera") >= 0) {
    		return "Opera";
    	}
    	//Safari
    	else if (explorer.indexOf("Safari") >= 0) {
    		return "Safari";
    	}
    }
    
    function isIE() {
    	if (!!window.ActiveXObject || "ActiveXObject" in window)
    		return true;
    	else
    		return false;
    }

    //计算宽度高度
    function autoWinSize() {
    	var clientHeight = document.documentElement.clientHeight - 100;
    	var clientWidth = document.documentElement.clientWidth * 0.85;
    	var ex = getExplorer();
    	var exheight = 24;
    	if ("Firefox" == ex) {
    		exheight += 10;
    	}
    	if ("IE" == ex) {
    		exheight += 15;
    	}
    	if (clientWidth < 800) {
    		clientWidth = 800;
    	}
    	if (clientWidth > 1000) {
    		clientWidth = 1000;
    	}
    	if (clientHeight < 200) {
    		clientHeight = 200;
    	}
    	if (clientHeight > 496) {
    		clientHeight = 496 + exheight;
    	}
    	return {
    		height: clientHeight,
    		 clientWidth
    	};
    }
    

     

     
  • 相关阅读:
    事件冒泡
    Tomcat 不能正常启动
    mybatis(非常详细的哦~~~~)
    javadoc 工具生成开发API文档
    Java 泛型
    Tomcat 服务器详解
    J2EE 工作中注意事项
    Java 枚举
    Break,Continue,Return
    位运算符
  • 原文地址:https://www.cnblogs.com/renpei/p/15148254.html
Copyright © 2011-2022 走看看