Ideas on how to make direction-aware scrolling div?

Ideas on how to make direction-aware scrolling div?

Sorry for the confusing title.. but what I'm looking for is something similar to the scroll follow plugin, but have it detect which direction the user was scrolling.  If something like this already exists, even better.  But if not, I'll try to make a plugin myself.  

The point is when the div that follows the scrolling is taller than the window it's in.  In a situation like this, I want the bottom of the div to peg to the bottom of the window when I'm scrolling down, but have it peg to the top when scrolling up. 

I can see a couple of potential ways to approach this.  One would be if there is a way to detect scrolling direction (I have found ways to detect the direction of the mouse scroll wheel, but I don't want to limit it to scroll wheels) -- if so, modifying the Scroll Follow plugin wouldn't be difficult. 

If there is no way to detect scrolling direction directly, I'm looking for ideas on how to go about doing that.  Or other ideas on how to implement this plugin idea.  It might be simply detecting if the bottom edge of the div goes below the bottom edge of the window, and if so, move the div up.  Likewise for the top edge. 

Thanks!

Bryan