Search code examples
jqueryheightprototypejs

innerheight equivalent in prototype


I have this piece of code that calculate height for an element:

//resize bar
var outer_container_id = "workspace_container";
var inner_container_id = "listing_data_container";
var constant_px = 45 + 26 + 25 + 60;

window.onresize = function() {
    var new_height = $(outer_container_id).getHeight() - constant_px;
    if($(inner_container_id) != null){
        $(inner_container_id).setStyle({ 'height' : new_height + 'px'});
    }

};

but it leaves a gap cause I think it doesn't include padding etc.. whats the prototype equivalent for jQuery's innerHeight?

Thanks


Solution

  • Take a look at the Element.Layout methods.

    In this instance you are looking for

    var layout = $(outer_container_id).getLayout();
    var new_height = layout.get('border-box-height') - constant_px;