Log in

View Full Version : Table Always on top



TrueFangz
07-05-2006, 10:29 PM
Is there a way that I can have a table on a page that always hovers on top of the window?

I tried using a few scripts I found in the navigation area of DD, but I couldn't get them to look the way I want them.

This is what my table script looks like...


<table onMouseover="changeto(event, 'images/navbarhov.png')" onMouseout="changeback(event, 'images/navbar.png')" border="0" width="100%" id="table1" style="border-collapse: collapse; background-image: url('images/navbar.png'); background-repeat: repeat-x; position:absolute; left:0px; top:0px; width:792px" height="32" style='position:absolute;top:0;left:0;'>

Looks and works great, the only thing I want to do now is have it horizontally centered, and have it static to the top of the page, so when the user scrolls down the page, the table will still be visible at the top of the window as they scroll.

Help would be highly appreciated. Thank you!

Twey
07-05-2006, 10:58 PM
You want to use position:fixed. Unfortunately, this doesn't work with IE, so you have to use one of various hacks. The most common is to put the whole page in a 100%x100% scrolling DIV, then have the table absolutely positioned outside of it.

Centring it is as easy as left:40%; or similar. It won't be perfect in all browsers and resolutions, but with a little tweaking, you can get it close enough.

TrueFangz
07-05-2006, 11:51 PM
Thank you for your suggestion, however, I can't get it to work the way I want. 100% height and width, doesn't do anything, so I dropped the height to 94%. That worked, but the width doesn't seem like it's actually covering 100% of the window.

I also at one point ended up with two scroll bars. I don't want that.

There is a floating menu javascript that I found...

http://www.dynamicdrive.com/dynamicindex1/sm/index.htm

It's almost like what I am trying to accomplish, but I want to make my own table with links and images in there, but I don't know java script, so I don't know how to edit it to use my table instead of what it defaults to.

Any suggestions on this possibillity?