Detect if elements enter viewport from top or bottom

Detect if elements enter viewport from top or bottom

Hey guys,

Is there a way to detect (onscroll) wether a div-container enters the viewport from below or from above, and then do something as long as the div remains in the viewport (in relation to scrolling-direction).

Thank you very much
Tobi