PDA

View Full Version : Floating Top Bar script to stay within its own div



LaChancecom
01-07-2009, 06:37 PM
1) Script Title: Floating Top Bar script

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/floatbar.htm

3) Describe problem: I really do love this script. What I am trying to accomplish is taking this script and placing it into a div instead of the body of the page.

Example: Say I have a header about 400 pixels in height. Right after the header I have a new div, and contained in that div is the floating bar. So when I scroll down I want my five pixels from the top to be within that div.

If I am not making sense please let me know.

Thank you

Snookerman
01-07-2009, 08:57 PM
That should be just fine. All you need to do is make sure the div containing the bar is positioned:

#wrap {
position: relative;
}

<div id="wrap">
<div id="topbar">
Your content here.
</div>
</div>

Good luck!