directive to register handler when an element is scrolled down near its end