try this: var wh = $(window).height(); // window height var mt = $('#myDiv').offset().top; // top position of #myDiv
$(mt).css('height', wh - mt - 20 + 'px'); // set height of #myDiv On Sep 29, 8:33 am, Kabelkultur Gotland <[EMAIL PROTECTED]> wrote: > Well, the $(window).height() gets the height for me. > > What I need is something to measure the distance from the window top > and down to the element top. > And then subtract it from the window height, minus another 20 pix ad > use that value as height for the div. > > If the window is 1000 px high, and the div starts 300px down, I'd like > to get 100 - 300 - 20 = 680 > And then apply this as height for the div. > > And this needs to be done without mixing in other elements that might > or might not be part of the dom tree between the window top and the > elements top position. > > So I guess that the problem lies within the second measuring parameter > of my function: > $ (".tableHolder").offset().top - this for some reason uses other > positioned elements for its calculation, and I need it not to. > > Regards, Torgil - kabelkultur.se