user2562674
user2562674

Reputation: 41

PJAX / Masonry failing in Firefox

On my wordpress website (http://goo.gl/J8qrSE) I am using Masonry (masonry.desandro.com) and PJAX (https://github.com/defunkt/jquery-pjax) for transitions.

Everything works fine in Chrome & IE but in Firefox the homepage loads fine, you can click on a gallery (again, works fine), but when you click on the logo to go back to the homepage all the masonry images are stacked on top of each other like masonry hasn't run properly.

The weird thing is that it works perfectly if firebug is open (docked or in a separate window) but then it sometimes works / sometimes doesn't if firebug is closed.

I don't have any stray console.logs anywhere that I can find but it's hard to debug when it works every time I have firebug open.

Upvotes: 2

Views: 160

Answers (1)

Macsupport
Macsupport

Reputation: 5444

Try loading the script imagesloaded.js and then call masonry like this:

function domasonry() {
    var container = document.querySelector('#griddy');
    var msnry;

    imagesLoaded( container, function() {
      msnry = new Masonry( container, {
      itemSelector: '.item',
      columnWidth: '.item'
      });
    });
   };

Upvotes: 1

Related Questions