Fix negative scroll (e.g. in OS X browsers)

Some browsers, e.g. Safari and Chrome on Mac OS X, allow scrolling past the top and bottom of the page (snapping back when the scrolling stops, creating an "elastic" effect). This creates an ugly effect that can be prevented by ensuring `scrollTop` stays between 0 and the height of the document (given by jQuery's `$(document).height()` for best compatibility).

Before (notice the "negative scrolling" at the top of the document): ![before](https://cloud.githubusercontent.com/assets/4964364/4460187/cfdafe68-48b0-11e4-817e-cf18ee7feaa3.png)

After: ![after](https://cloud.githubusercontent.com/assets/4964364/4460188/cfdae892-48b0-11e4-85bb-8fc37f78530b.png)