Skip to content
This repository has been archived by the owner on Oct 5, 2022. It is now read-only.

Window scroll events #8

Open
bright-light-in-the-night opened this issue Jan 12, 2016 · 0 comments
Open

Window scroll events #8

bright-light-in-the-night opened this issue Jan 12, 2016 · 0 comments

Comments

@bright-light-in-the-night

When a user scrolls the page, multiple events are called, even for a single scroll. You can see it in Firebug. Because of this, the plugin is slow on single core computers (browser gets unresponsive) and browsers that have scroll events plugins.
To fix this, this is what I have done and it works great:

After "jQuery.fn.UItoTop = function(options) {" I set a variable "var _t;" . After this "jQuery(window).scroll(function() {" I set "clearTimeout(_t);" and wrap the whole code below in "_t = setTimeout(function() { /* code */ }, 100);"

I hope this gets implemented. And thanks for this plugin.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant