Getting actual height of an auto-heighted element in IE

前端 未结 6 2125
不知归路
不知归路 2020-12-21 15:18

I\'m pretty confused! with this:

...
...COLUMN1
6条回答
  •  太阳男子
    2020-12-21 15:24

    As a completion for Marc's answer; There's an equal for jQuery's height() in Prototype:

    $('col1').getDimensions().height //or .width ofcourse
    

    And here's the docs: http://prototypejs.org/api/element/getDimensions

    Update: I agree with crescentfresh below. Since I had the absolute same problem in the past, I've searched all possible methods to find the dimension properties but I failed as you will. please take a look at this:

    function getStyle(oElm, strCssRule){
        var strValue = "";
        if(document.defaultView && document.defaultView.getComputedStyle){
            strValue = document.defaultView.getComputedStyle(oElm, "").getPropertyValue(strCssRule);
        }
        else if(oElm.currentStyle){
            strCssRule = strCssRule.replace(/\-(\w)/g, function (strMatch, p1){
                return p1.toUpperCase();
            });
            strValue = oElm.currentStyle[strCssRule];
        }
        return strValue;
    }
    

    As you see, the function has been written to get the computed rendered current style of an element, but in our case even this method will fail, I guess. (worth a try)

    So, as crescentfresh said, you have to find the problem in your CSS positioning method while not wasting your time seeking for a proper javascript function which could be able to do the magic. let's begin by removing that #content DIV and letting the #main to be the only wrapper of said columns, and then styling the remain to achieve the desired goal.

提交回复
热议问题