Paul Jr
10-22-2003, 11:13 PM
Is there anyway to get something to stick to the top of the page, even when you are scrolling, without having to use an Iframe?
|
Click to See Complete Forum and Search --> : "Fixed" Positioning... Paul Jr 10-22-2003, 11:13 PM Is there anyway to get something to stick to the top of the page, even when you are scrolling, without having to use an Iframe? DaveSW 10-23-2003, 02:28 AM You can use position:fixed, but I don't think IE supports it yet. Other than that there are some complex dhtml things you can do to make it work, http://www.easynetit.co.uk Is an example of something like that. clairec666 10-23-2003, 06:11 AM I have seen some javascripts that keep, for example, a small menu at the top of the page, but these can be very annoying! I can't work out the script at the moment, but you use the onscroll event handler to call a function which sets the position of the <div> to top:0px; left:0px; pyro 10-23-2003, 07:37 AM You can use a combination of JavaScript and CSS to do this. As Dave said, the CSS position: fixed will be used for browser such as NN7 and Mozilla, and a bit of JavaScript will be used for IE and older browsers. http://www.infinitypages.com/research/staticmenu.htm Vladdy 10-23-2003, 08:08 AM You can achieve the "sticking" effect with absolute positioning: .fixed { position: absolute; top: 0px; left: 0px; margin: 0px; padding: 0px; border: none; width: 100%; height: 20%; overflow: hidden; } .scrollable { position: absolute; top: 20%; left: 0px; margin: 0px; padding: 0px; border: none; width: 100%; height: 80%; overflow:auto; } However this approach screws up keyboard scrolling in some browsers which can be very annoying if you are used to using up and down keys to go through the page... IE treats fixed as absolute so I would jsut go with a design that behaves "fixed" in Gecko and Opera ano other compliant browsers and degrades to "absolute" in IE. Good example of such layout is http://www.w3.org/Style/CSS/ Still you need to be VERY carefull with using fixed positioning (or absolute positioning with hidden overflow for that matter). Using the above link as an example, if you reduce the height of the window, some links become unaccessible. Simple scrollable canvas is always a safe solution. If your navigation scrolls out of view it's easy for user to get back to it. Paul Jr 10-23-2003, 02:21 PM Whoo! Thanks a bunch. Paul Jr 10-23-2003, 04:17 PM Okay, different train of thought. Assuming there is a way, how would you get that same something, which is now in a Iframe, to stick to the top of the page? DaveSW 10-24-2003, 10:07 AM You would normally put the stuff to stay at the top of your page at the top of your page and put an iframe underneath it for the rest Paul Jr 10-24-2003, 11:41 AM Ah, right. I figured as much. Thanks for your help, much appreciated. webdeveloper.com
Copyright Internet.com Inc., All Rights Reserved. |