I have been reading tutorials from several different places like http://css-tricks.com/scrollfollow-sidebar/ or http://jqueryfordesigners.com/fixed-floating-elements/
and have been playing around with them but cant seem to figure out how I would be able to add more then just that one sliding box on the page. Any thoughts?
I have been reading tutorials from several different places like http://css-tricks.com/scrollfollow-sidebar/ or http://jqueryfordesigners.com/fixed-floating-elements/ and
Share
My assumption (from the first example link) is that instead of just having
#sidebarstay in view, you want to have another element scroll with the window as well (i.e. logged in user’s details).The easiest way would be to add this information to your existing scrolling element:
However, if you want to scroll two elements with the window:
It would just be a matter of animating both of their margin-top’s inside the
$(window).scroll()event handler:Edit
The following code scrolls
#sidebaruntil it reaches 2000px of scroll at which point it stops and scrolls#user-detailsuntil it reaches 4000px of scroll:You can see it in action here.