Use the height of the container for scrolling

If the $scroller element has a parent with innerHeight set just use that instead of the height of the browser window for scrolling.