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

Simple support for single page applications #53

Closed
wants to merge 1 commit into from

Conversation

nandy-andy
Copy link

As suggested in #24 I'm creating this pull request. It's a simple approach to have jquery-scrolldepth working on single page applications such as applications created in AngularJS or EmberJS.

I've added public reset() method which resets state of the plugin. It can be executed in a SPA with some kind of a hook before transition to new view ends.

@robflaherty is afraid of making the plugin overloaded with options and most likely will remove new detachEventOnceCacheIsFull option. It shouldn't be painful. Frankly, I'm not sure if the options is even needed. I did few test. Removed it and removed the condition in lambda function passed to $window.on('scroll.scrollDepth'.... My Ember app still works without errors. Maybe there is no need to taking care of attaching and detaching the event 😝

added .gitignore

added possibility to keep the onscroll event handler stay even if the cache is full

constructor returns an object with a method which resets the cache

updated bower.json so it have the correct version

set lastPixelDepth to 0 when reseting; renamed function so it is more descriptive

one small detail I missed - fixed
@robflaherty
Copy link
Owner

Thanks! Merged into v08 dev branch b13de45.

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.

2 participants