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

Implementation of a 'reload' method (extremely useful to rebind an updated DOM) #153

wants to merge 1 commit into
base: master


None yet
2 participants

antoinekociuba commented Jul 23, 2014

Sometimes, DOM can be updated by external actions/scripts (especially the items container).

It results that the infinite scroll is not working anymore, due to an obsolete binded DOM in getLastItem() method. It results the following incorrect calculation in getScrollThreshold() method:

$lastElement.offset().top will always equal 0.
$lastElement.height() will always equal 0.
currentScrollOffset >= scrollThreshold will never happen in scrollHandler() method.

By using the new reload() method after a DOM change, we redefine items container and calculations are back to normal.


This comment has been minimized.


fieg commented Jul 24, 2014

Thank you for your work, it looks absolutely good, although I was brainstorming about one thing (not sure if it would work): perhaps we can achieve the same functionality with less code if the redefining of the this.$itemsContainer would happen in the bind method? This way someone could simply call unbind and bind to reload and we could even make a simple convenience method like this:

reload = function() {

Please let me know how you think about this and if you think this would work.


This comment has been minimized.


antoinekociuba commented Jul 24, 2014

Hi Jeroen,

Actually, redefining this.$itemsContainer in bind method is a really good idea and we avoid code duplication. So I'd go for that solution. :)

But in that case, I don't see any interest of using a reload method as we can call direcly unbind and bind as we need, depending on the purpose.

(Thank you for that plugin btw :))

@fieg fieg referenced this pull request Oct 14, 2014


Caching items container #161

@fieg fieg closed this in 3ae5b4e Dec 9, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment