Brendon Branigin Posted March 20, 2006 Share Posted March 20, 2006 i have a 3 column layout setup and the right column is a 2nd nav system for sections within a page (using named anchors) i want this div to always appear on screan (scrolls with page) how can i do this? Link to comment Share on other sites More sharing options...
manojdubey Posted March 21, 2006 Share Posted March 21, 2006 Hi Brendon BraniginTry the following code.<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><!-- saved from url=(0069)http://www.w3schools.com/dhtml/tryit_view.asp?filename=trydhtml_menu4 --><HTML><HEAD><META http-equiv=Content-Type content="text/html; charset=windows-1252"><script type=text/javascript>var timerfunction scrolltop(){document.getElementById('scrollmenu').style.pixelTop=document.body.scrollToptimer=setTimeout("scrolltop()",1)}function stoptimer(){clearTimeout(timer)}</SCRIPT><META content="MSHTML 6.00.2900.2722" name=GENERATOR></HEAD><BODY onload=scrolltop() onunload=stoptimer()><SPAN id=scrollmenu style="POSITION: absolute"><B>Menu</B><BR><A href="http://www.w3schools.com/">W3Schools</A><BR><A href="http://www.microsoft.com/">Microsoft</A><BR><A href="http://www.altavista.com/">Altavista</A><BR></SPAN><TABLE width="100%" border=0> <TBODY> <TR> <TD width=100> </TD> <TD>Scroll this page to see the "always-on-top" menu <BR><BR><BR><BR><BR>Scroll this page to see the "always-on-top" menu <BR><BR><BR><BR><BR>Scroll this page to see the "always-on-top" menu <BR><BR><BR><BR><BR>Scroll this page to see the "always-on-top" menu <BR><BR><BR><BR><BR>Scroll this page to see the "always-on-top" menu <BR><BR><BR><BR><BR>Scroll this page to see the "always-on-top" menu <BR><BR><BR><BR><BR>Scroll this page to see the "always-on-top" menu <BR><BR><BR><BR><BR>Scroll this page to see the "always-on-top" menu <BR><BR><BR><BR><BR>Scroll this page to see the "always-on-top" menu <BR><BR><BR><BR><BR>Scroll this page to see the "always-on-top" menu <BR><BR><BR><BR><BR>Scroll this page to see the "always-on-top" menu <BR><BR><BR><BR><BR>Scroll this page to see the "always-on-top" menu <BR><BR><BR><BR><BR></TD></TR></TBODY></TABLE></BODY></HTML> Link to comment Share on other sites More sharing options...
raimo Posted March 21, 2006 Share Posted March 21, 2006 i have a 3 column layout setup and the right column is a 2nd nav system for sections within a page (using named anchors) i want this div to always appear on screan (scrolls with page) how can i do this?<{POST_SNAPBACK}> With all real browsers You can use position fixed.Here is trick how it can be done with MSIE too, but You must useright DTD to get it operate with MSIE. DTD must be either HTML 4.01 Transitional with URL or HTML 4.01 Strict,or then some XHTML DTD and XHTML code.In here we use HTML 4.01 Transitional with URL:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd"><html><head><title>cool pos fixed menu</title><style type="text/css"><!--/* this is for real browsers */#menu{position: fixed;right: 0;top:0;}--></style><!--[if lt IE 7]><style type="text/css">/* this is only for MSIE < 7 */body {background: url(#) fixed; /* MSIE trick, do not remove */}#menu{position: absolute;top: expression(eval(document.documentElement.scrollTop));right: 0;}</style><![endif]--></head><body><div id="menu">1st. menu line<br>2nd. menu line<br></div><div>Some nice stories in here</div></body></html> Will work with all real browsers and MSIE 6.x >But as I say, will not work with MSIE if DTD is wrong.edit:You can set top position other than 0 like this (75px):top: expression(eval(document.documentElement.scrollTop + 75)); Link to comment Share on other sites More sharing options...
Brendon Branigin Posted March 21, 2006 Author Share Posted March 21, 2006 thanks, these are perfect Link to comment Share on other sites More sharing options...
Guest Juggernaut Posted March 23, 2006 Share Posted March 23, 2006 Why not making a top div and a lower one with overflow:scroll; ?? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now