mercredi 29 avril 2015

How can I wrap jQuery Justified Gallery in an Ember Component?

I'm trying to wrap the plugin Justified Gallery in an Ember component. The main problem that I'm facing is that the list of photos in the gallery come from an API, so they're part of the model. What I have so far:

App.JustifiedGalleryComponent = Ember.Component.extend({
    _init: function() {
        this.$().justifiedGallery({
            rowHeight: 150,
            fixedHeight: false,
            margins: 7
        });
    }.on('didInsertElement')
});

Template

{{#each photo in items}}
  <div>
    <img src={{photo.thumbUrl}} />
  </div>
{{/each}}

But I can't get that to work, probably because the list of photo is inside an each loop, and when the plugin is applied the photos are still not in the DOM? What would be the approach for this problem?

Thanks!




Aucun commentaire:

Enregistrer un commentaire