Hi, i'm trying to make a menu that will follow me as I scroll down the window,
somethins like this, (look on the right and on the left)
please use IE to see, firefox doesn't display properly


i have found some java script, however I want the menu move smoothly as i scroll, any help is appreciated

Recommended Answers

Research the JavaScript "scrollto" functions. I've moved this thread to the proper forum.

Jump to Post

All 2 Replies

Research the JavaScript "scrollto" functions. I've moved this thread to the proper forum.

FF allows the style "position:fixed;". That will fix the element in a certain position relative to the screen.
You can emulate it with IE and other browsers by creating a DIV as the first child of the body to emulate the body.
Remove all padding, spacing, borders from the BODY and also set "scroll:none;overflow:hidden;" in CSS and in javascript disable the scroll.
Then give your DIV thats emulating the body a overflow:auto;.

Then when you want to make a DIV fixed, just place it outside the DIV that you are using as the BODY, and make it absolutely positioned.

See an example: http://tagsoup.com/cookbook/css/fixed/

This is better to moving the Element when onscroll is triggered.

If you want to go with onscroll event, then don't jump directly to the scroll offset, use an incremental approach...

pseudo code:
while (body_scroll_offset > absolute_div_position) { absolute_div_position++ }

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.