stevenschobert/instafeed.js

How to get instafeed working with masonry

gertjanjanssen opened this issue · 2 comments

Hi, even since i upgraded instafeed to version 2 i haven't been able to get it to work with the masonry. I've been able to get masonry working with other Wordpress posts, but i haven't been successful with instafeed.

Does anyone has a suggestion to get it working;

Got it! #118 (comment) this helped;
In my case:

<script>$(document).ready(function() {
  var feed = new Instafeed({
    accessToken: InstagramToken,
	  template: '<div class="col-md-4 col-sm-4 col-xs-6 margin_bottom"><a href="{{link}}"><img class="img-responsive" title="{{caption}}" src="{{image}}" /></a></div>',
   after: function () {
// init Masonry
var $grid = $('.grid').masonry({
  itemSelector: '.col-md-3, .col-md-6, .col-md-4',
  percentPosition: true,
  columnWidth: '.col-md-3, .col-md-6, .col-md-4'
});
// layout Masonry after each image loads
$grid.imagesLoaded().progress( function() {
  $grid.masonry();
}); 
  }
});
feed.run();
  });

Hey @gertjanjanssen! Glad you were able to get it working! 🎉