Page 1 of 1
100% Visible Div
Posted: Sun Feb 18, 2007 4:58 pm
by iknownothing
Hey guys, I have a div that becomes visible upon clicking a link. The page uses vertical scrolling. What I want is a way for the div to pop up approximately 50px from the top of the browser frame, so no matter how far scrolled down you are, it still is completely visible. Does anyone know how this could be achieved?
Posted: Sun Feb 18, 2007 5:15 pm
by feyd
Code: Select all
d.style.top = window.pageYOffset + 10 + 'px';
d.style.left = window.pageXOffset + 10 + 'px';
works in Firefox to give an offset of 10,10 from the corner.
Posted: Sun Feb 18, 2007 5:37 pm
by iknownothing
cheers for that, any way this can work in IE?
Posted: Sun Feb 18, 2007 5:46 pm
by feyd
I'd bet you can find examples with some searching.
Posted: Sun Feb 18, 2007 5:50 pm
by Kieran Huggins
you'll want to use CSS to specify "position:fixed;"
Posted: Sun Feb 18, 2007 11:01 pm
by iknownothing
thanks Kieran, bit of "standards mode" for IE6 (and IE 7.05730 apparently) and I was happy.