I have

```
<div class="js-masonry" data-masonry-options='{ "columnWidth": 50, "itemSelector": ".item", "gutter" : 20 }'>
      <div class="item"><a href="/photo/side-portrait"><img src="/assets/uploads/_default/T96A9589-2.jpg" alt="T96A9589-2" width="909" height="1364"/></a></div>
      <div class="item"><a href="/photo/butterfly"><img src="/assets/uploads/_default/T96A7105-2.jpg" alt="T96A7105-2" width="2046" height="1364"/></a></div>
      <div class="item"><a href="/photo/white-shirt"><img src="/assets/uploads/_default/T96A6883.jpg" alt="T96A6883" width="2046" height="1364"/></a></div>
</div>

```

which works ok with standard masonry functionality, but masonry is trying to do the layout before some of the images loaded so it's looking messed up.

I tried adding

```
$(function() {
        var $container = $('.js-masonry');
        // initialize Masonry after all images have loaded
        $container.imagesLoaded( function() {
            $container.masonry();
        });
    });

```

But it's not helping!

Is the issue me mixing the data attributes and the js code? Or is it something else i cannot see?
Any help very gratefully appreciated!

Added - .item css is

```
width: 49%;
margin-bottom: 15px;

```