desandro / masonry

:love_hotel: Cascading grid layout plugin
https://masonry.desandro.com
16.42k stars 2.11k forks source link

Few cards over lap over each other. #527

Closed evivz closed 10 years ago

evivz commented 10 years ago

I am using twitterbootstrap + masonry. Displaying cards in col-md-3 http://projects.vivek.be/ebaysearch/indexb.php?search=mobile

But issue is few cards overlap over each other.

Can any one help with this?

Thanks

desandro commented 10 years ago

Looks like your code needs to be run on document ready. I would also suggest using imagesLoaded. I see you're already using jQuery, so here's that code with jQuery

$(document).ready( function() {
  var $container = $('#ms-container');
  $container.imagesLoaded( function() {
    $container.masonry({
      itemSelector: '.ms-item',
      columnWidth: '.ms-item'
    });
  });
});
evivz commented 10 years ago

I did what you said and this is the end result! Extra vagant space : http://projects.vivek.be/ebaysearch/indexb.php?search=mobile

desandro commented 10 years ago

Looks like you're missing imagesLoaded script

evivz commented 10 years ago

@desandro thanks a lot it worked.

Can you tell me how to bind it with new content loaded by jscroll for infinite scroll ?

projects.vivek.be/ebaysearch/indexc.php?search=mobile

desandro commented 10 years ago

See https://github.com/desandro/masonry/issues/476#issuecomment-32229875