-2

please help solve the problem. for dense packing blocks I used a popular plugin masonry.

my resulting code is not worked. but I used the method described in the documentation

$('#container').masonry({
  itemSelector: '.box',
  // set columnWidth a fraction of the container width
  columnWidth: function( containerWidth ) {
    return containerWidth / 5;
  }
});

css:

#container{
    max-width: 1000px;
    margin: 0 auto;
    overflow: hidden;
}

    #container .item{
        width: 33.3%;
        background: red;
        float: left;
    }
stackow7
  • 15
  • 2

1 Answers1

0

Your fiddle references the masonry v3 library.

For this syntax (http://jsfiddle.net/6ashzfo6/4/):

$('#container').masonry({
  itemSelector: '.box',
  // set columnWidth a fraction of the container width
  columnWidth: function( containerWidth ) {
    return containerWidth / 5;
  }
});

Use the v2.1.08 as in the documentation you linked to.

Ben Grimm
  • 4,136
  • 2
  • 13
  • 24