Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

only register scroll event handler if necessary (expensive in IE) #44

Merged
merged 1 commit into from
Sep 26, 2013

Conversation

frohoff
Copy link
Contributor

@frohoff frohoff commented Sep 25, 2013

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.

@ghost ghost assigned gfranko Sep 26, 2013
gfranko added a commit that referenced this pull request Sep 26, 2013
only register scroll event handler if necessary (expensive in IE)
@gfranko gfranko merged commit 3c71516 into gfranko:master Sep 26, 2013
@gfranko
Copy link
Owner

gfranko commented Sep 26, 2013

Thanks for the PR! I wonder if I should also implement a short (100-200 ms) debounce.

gfranko added a commit that referenced this pull request Sep 26, 2013
@frohoff frohoff deleted the conditional-scroll-event-handler branch September 30, 2013 17:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants