Open pedropaf opened 9 years ago
Currently, the addon destroys the masonry layout and then re-initializes it when items
changes. This is partially due to a lackluster API for the jQuery Masonry plugin. I'm working on a new version of the addon that uses the Masonry library rather than the jQuery plugin, so we can hopefully make adding and removing items
more performant.
@gmurphey thanks for the library. it's really awesome. adding infinite scroll would be the icing on the cake!!!
thanks again :smile:
:+1: Love this little library. With infinite scrolling, I will have everything I need! :D
+1 for this.
I'm trying to do infinite scrolling, but once new items are loaded and masonry re-initialize page jump to top.
Okay, I've figured out that by myself. I've changed items observer so when new items are added it runs masonry appended
method and doesn't re-initialize. It works great now.
layoutMasonry: Ember.observer('items.@each', function () {
imagesLoaded(this.$(), () => {
if (!this.get('masonryInitialized')) {
this.$().masonry(this.get('options'));
this.set('masonryInitialized', true);
} else {
var $new = [];
$new = $(this.get('options.itemSelector')).filter(function() {
return $(this).css('position') !== 'absolute';
});
this.$().masonry('appended', $new);
}
});
})
@dzbo nice one that looks almost too easy
do you support infinite scrolling? I have seen that the list of items is observed, but are they added in a nice way or the whole library is reset?
Thanks