-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
destroy & re-initialize, ._init is not a function #807
Comments
Thanks for reporting this issue. Could you post the code you're using, where you're triggering |
Hi, thanks for your reply. I added my code to your pen (I tried 2 different methods): https://codepen.io/anon/pen/aKMzLa |
Thanks for that. You should be able to re-initialize both Infinite Scroll and Masonry by first destroying both plugin instances $(document).on("click", ".reload", function(e) {
$grid.infiniteScroll('destroy');
$grid.masonry('destroy');
initMasonry();
}); See demo https://codepen.io/desandro/pen/ab2cc8162dde24c18ff12caf360d6186 However, there currently is a bug that doesn't properly remove jQuery data on // duck punch
var destroy = InfiniteScroll.prototype.destroy;
InfiniteScroll.prototype.destroy = function() {
destroy.apply( this, arguments );
// remove jQuery data
if ( jQuery && this.$element ) {
jQuery.removeData( this.element, 'infiniteScroll' );
}
}; |
Awesome! Thanks a lot! |
Infinite Scroll v3.0.5 has been released. |
Hi, my website shows photos like this CodePen, but with photos from a remote source: https://codepen.io/desandro/pen/eRRQVo
Now I would like to add a button which will 'refresh' the InfiniteScroll instance, to show newly added photos from the remote source. I tried with
$container.infiniteScroll('destroy')
and reinitializing InfiniteScroll, but that gives an errorUncaught TypeError: o._init is not a function
Any ideas? Thanks in advance!
The text was updated successfully, but these errors were encountered: