gfranko/jquery.tocify.js — pull request #44 by frohoff (2013-09-25 22:45:34+00:00)
Title: only register scroll event handler if necessary (expensive in IE)

If the scroll event handler is always attached, even with the scroll-detection related features disabled (`extendPage: false, scrollHistory:false, showAndHideOnScroll: false, highlightOnScroll: false`), there is a notable lag in IE due to performance issues with jQuery's `scrollTop()` (http://stackoverflow.com/a/5001300).

This code change simply wraps the registration of the event handler in a check so that it is only registered if one of the relevant options is enabled to avoid wasting resources in a handler that ends up doing no work.