1.11M Members

Make a jQuery "stick" to the top edge of the browser window?



I have a jQuery Thickbox window and I want to make it stick as far as possible to the top of the browser window, so the top is visible.

If the bottom is not visible, this (for now) is not a problem.

How can I do it?


Use CSS. You will want to set the display property to fixed (if you don't want it to scroll with the page) or absolute (if you do want it to scroll with the page). You will want to set the top property to 0.


hmmm....is there another way to do it/calculate it using margin top/bottom?


Sure you could, but CSS would be the easiest and most accurate. Just you the developer tool bar (firebug, IE devtoolbar or Chrome's) to help you figure out the selector you need to use for the CSS.


What do you mean by "so the top is visible"? The top of the thickbox or some other header on the top of the page?

Isn't it about time forums rewarded their contributors?

Earn rewards points for helping others. Gain kudos. Cash out. Get better answers yourself.

It's as simple as contributing editorial or replying to discussions labeled or OP Kudos

This article has been dead for over six months: Start a new discussion instead
Start New Discussion
Tags Related to this Article