关于jquery 根据窗口变化 改变里面div 的长宽 要求div 始终 覆盖整个 窗体

解决方案 »

  1.   

    用下面两个函数获得屏幕,然后动态改变div长宽,用不用jquery都是这个办法//得到浏览器显示的屏幕高度
    document.getViewportHeight = function(){
        if (window.innerHeight!=window.undefined) return window.innerHeight;
        if (document.compatMode=='CSS1Compat') return document.documentElement.clientHeight;
        if (document.body) return document.body.clientHeight;
        return window.undefined;
    }
    //得到浏览器显示的屏幕宽度
    document.getViewportWidth = function(){
        if (window.innerWidth!=window.undefined) return window.innerWidth;
        if (document.compatMode=='CSS1Compat') return document.documentElement.clientWidth;
        if (document.body) return document.body.clientWidth;
    }