0

I'm used Packery for auto ajust images on site: http://jsfiddle.net/tryjkvg3/

var container = document.querySelector('#container');
var pckry = new Packery(container, {
    // options
    itemSelector: '.lista-isotope',
    gutter: 0
});

sometimes the images show this way: enter image description here

the correct is: enter image description here

But, if resize the window, images ajust and stay fine. How force images show every time correct without do a resize in the window

1 Answers1

0

I find the solution: Using masonry with imagesloaded

so, my final code:

$(document).ready(function() {

  var $boxes = $('.lista-isotope');
  $boxes.hide();

  var $container = $('#container');
  $container.imagesLoaded( function() {
    $boxes.fadeIn();

    $container.masonry({
        itemSelector : '.lista-isotope',
        gutter: 0,
        isAnimated: !Modernizr.csstransitions
    });    
  });
});   

its necessary use imagesloaded

Community
  • 1
  • 1