Not the cleanest, but this minimizes the number of times scrollTop is read and written, and classes are toggled.
This greatly improves IE performance. This still needs more work to clean things up and maintain all
previous functionality.