I know about the location of the div (fixed, absolute, and relative). I can attach a fixed div to the body so that it adheres to the same position while scrolling through the body. Here I ask a slightly different question.
I have a sidebar with a height greater than the height of the viewport, and I want it to be attached to the body. When scrolling through the body, it should also scroll, but as soon as the bottom of the fixed div is visible, it should not scroll with the body.
For example, the right sidebar of a Facebook wall scrolls with the body and stops scrolling with the body when the bottom of the right sidebar is visible (fixed).
Miraj source share