1,105,594 Community Members

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

Member Avatar
riahc3
 
1,404 posts since May 2008
Reputation Points: 45 [?]
Q&As Helped to Solve: 14 [?]
Skill Endorsements: 18 [?]
Team Colleague
 
0
 

Hello

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?

Member Avatar
stbuchok
Posting Shark
957 posts since May 2011
Reputation Points: 123 [?]
Q&As Helped to Solve: 142 [?]
Skill Endorsements: 2 [?]
 
0
 

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.

Member Avatar
riahc3
 
1,404 posts since May 2008
Reputation Points: 45 [?]
Q&As Helped to Solve: 14 [?]
Skill Endorsements: 18 [?]
Team Colleague
 
0
 

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

Member Avatar
stbuchok
Posting Shark
957 posts since May 2011
Reputation Points: 123 [?]
Q&As Helped to Solve: 142 [?]
Skill Endorsements: 2 [?]
 
0
 

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.

Member Avatar
JorgeM
IT Addict
6,419 posts since Dec 2011
Reputation Points: 581 [?]
Q&As Helped to Solve: 963 [?]
Skill Endorsements: 172 [?]
Moderator
Featured
Sponsor
 
0
 

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?

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