I have a div in my HTML page which I want to act like a floating menu after page scrolls up to certain pixels.
I tried this here http://jsfiddle.net/JnbQQ/1/
Problem is once the user scrolls up, the div looses its margin which is set to auto and moves to left corner of the page.
Can someone please help?
You might want to take a look at jquery Waypoints plugin.
Site:
http://imakewebthings.github.com/jquery-waypoints/
Demo:
http://imakewebthings.github.com/jquery-waypoints/sticky-elements/