Hello!

I have a strange issue, since Firefox 3 came up: i use thickbox to launch a
page inside a modal window. On this page runs a custom plugin that resizes
automatically a div to the available window height. I then use jscrollpane
to have a good looking custom scrolbar appended to that div.

What happens now is that on page load the new height calculation amounts to
0. If i refresh the page, then the height is correctly evaluated.

Here is the plugin i made, can someone help me find and correct the bug?
I've tried everything i could to make it work, but so far... failed. The bug
only occurs with Firefox 3.

jQuery.fn.setScrollableArea = function(modifier){
    var availableHeight = jQuery(window).height();
    return this.each(function(){
        var offset = jQuery(this).offset();

        modifier = (typeof modifier == 'undefined') ? 0 : modifier;
        var newHeight = availableHeight - offset.top - modifier;
        alert('available height='+availableHeight+ "\n top="+offset.top); //
all values are calculated as 0 until i refresh the page !!
        jQuery(this).css({
            height: newHeight,
            overflow: 'hidden'
        });
    });
}

I call it everytime i need it via:

$(document).ready(function(){

    $('#section_content').setScrollableArea(30).jScrollPane({
        scrollbarWidth: 13,
        scrollbarMargin: 10,
        animateTo: true
    });

});

Any help would be much appreciated.
Thank you,

Alexandre

Reply via email to