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

Update jquery.infinite-pages.js.coffee for turbolinks #13

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

hwatkins
Copy link

@hwatkins hwatkins commented Feb 5, 2015

I had an issue where if you went off the page with the infinite scrolling and back on the scrolling was broken because the next link was cached.

I created a sample app https://github.com/hwatkins/endless_kaminari with turbolinks enabled to show how it works.

I'm not an expert at javascript or coffeescript so there may be a better way, but this worked for me.

Fix caching issue with turbolinks
# Constructs the new InfinitePages object
#
# container - the element containing the infinite table and pagination links
constructor: (container, options) ->
@options = $.extend({}, @defaults, options)
@$container = $(container)
@container = '.'+container.className;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This introduces new dependencies on the container argument. With your change it look like it has to be a DOM element with a class name instead of a jQuery CSS selector

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your right, it would take more work to make it a generic selector.

@zmillman zmillman changed the title Update jquery.infinite-pages.js.coffee Update jquery.infinite-pages.js.coffee for turbolinks Feb 6, 2015
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