Javascript:IE全高

Javascript:IE全高,javascript,lightbox,lightbox2,Javascript,Lightbox,Lightbox2,我有以下代码来计算lightbox插件的窗口宽度 quirksmode.com提供的getPageSize() * *@return数组返回一个包含页面宽度、高度和窗口宽度、高度的数组 */ 函数uuuu getPageSize(){ var xScroll,yScroll; 如果(window.innerHeight&&window.scrollMaxY){ xScroll=window.innerWidth+window.scrollMaxX; yScroll=window.innerHei

我有以下代码来计算lightbox插件的窗口宽度

quirksmode.com提供的getPageSize() * *@return数组返回一个包含页面宽度、高度和窗口宽度、高度的数组 */ 函数uuuu getPageSize(){ var xScroll,yScroll; 如果(window.innerHeight&&window.scrollMaxY){ xScroll=window.innerWidth+window.scrollMaxX; yScroll=window.innerHeight+window.scrollMaxY; }else if(document.body.scrollHeight>document.body.offsetHeight){//all,但不包括Explorer Mac xScroll=document.body.scrollWidth; yScroll=document.body.scrollHeight; }否则{//explorerMac…也可以在Explorer6、Mozilla和Safari中使用 xScroll=document.body.offsetWidth; yScroll=document.body.offsetHeight; } var窗口宽度、窗口高度; if(self.innerHeight){//除Explorer之外的所有 if(document.documentElement.clientWidth){ windowWidth=document.documentElement.clientWidth; }否则{ windowWidth=self.innerWidth; } windowHeight=self.innerHeight; }else if(document.documentElement&&document.documentElement.clientHeight){//Explorer 6严格模式 windowWidth=document.documentElement.clientWidth; windowHeight=document.documentElement.clientHeight; }else if(document.body){//其他探索者 windowWidth=document.body.clientWidth; windowHeight=document.body.clientHeight; } //对于总高度小于视口高度的小页面 if(yScroll<窗高){ 页面高度=窗口高度; }否则{ pageHeight=yScroll; } //对于总宽度小于视口宽度的小页面 如果(xScroll 我注意到,在InternetExplorer9中,当我点击一个图像并激活Lightbox插件时,透明的背面覆盖层只覆盖了可视高度,而不是整个高度

这就产生了一个问题,因为如果我有另一个带有修改过的Lightbox插件的图像,并单击透明覆盖层下方,它会在页面顶部打开另一个空的Lightbox窗口,并且无法关闭


它在Chrome和Firefox中运行良好。

实际上已经尝试在不使用javascript的情况下实现这一点,而只使用CSS?我认为IE使用document.documentElement。offsetWidth@redconservatory例如我指的是高度而不是宽度。不管怎样,我在控制台中尝试了
document.documentElement.offsetHeight
,它返回了可见高度。嗯,我认为对于灯箱,透明黑色覆盖层通常设置为覆盖可见高度,但该覆盖层的css应该是位置:固定的,而不是其他。如果没有,覆盖层将无法在您进入页面时正确滚动。我将
#jquery overlay
css属性
position
设置为
fixed
,它似乎在我的页面上起作用,但在另一个较短的页面上,覆盖层显示在lightbox图像下方。
     * getPageSize() by quirksmode.com
     *
     * @return Array Return an array with page width, height and window width, height
     */
    function ___getPageSize() {
        var xScroll, yScroll;
        if (window.innerHeight && window.scrollMaxY) {  
            xScroll = window.innerWidth + window.scrollMaxX;
            yScroll = window.innerHeight + window.scrollMaxY;
        } else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
            xScroll = document.body.scrollWidth;
            yScroll = document.body.scrollHeight;
        } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
            xScroll = document.body.offsetWidth;
            yScroll = document.body.offsetHeight;
        }
        var windowWidth, windowHeight;
        if (self.innerHeight) { // all except Explorer
            if(document.documentElement.clientWidth){
                windowWidth = document.documentElement.clientWidth; 
            } else {
                windowWidth = self.innerWidth;
            }
            windowHeight = self.innerHeight;
        } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
            windowWidth = document.documentElement.clientWidth;
            windowHeight = document.documentElement.clientHeight;
        } else if (document.body) { // other Explorers
            windowWidth = document.body.clientWidth;
            windowHeight = document.body.clientHeight;
        }   
        // for small pages with total height less then height of the viewport
        if(yScroll < windowHeight){
            pageHeight = windowHeight;
        } else { 
            pageHeight = yScroll;
        }
        // for small pages with total width less then width of the viewport
        if(xScroll < windowWidth){  
            pageWidth = xScroll;        
        } else {
            pageWidth = windowWidth;
        }
        arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight);
        return arrayPageSize;
    };