kristianmandrup / masonry-rails

JQuery Masonry plugin ready for use with Rails asset pipeline

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

images loaded under each other after images are loaded

TomSchillemans opened this issue · comments

If I go to my home page where a bunch of images are they are loaded under each other instead of next to each other. However when I refresh the page after they are next to each other again.

I don't know what this could be. Masonry is working!

$ ->
  $('#pins').imagesLoaded ->
    $('#pins').masonry
      itemSelector: '.box'
      isFitWith: true

That is my coffescript file as it stands at the moment.

EDIT

It looks like it only happens of the images are cached!
So I think it has something to do with the imagesLoaded thing.

Ok, I solved the issue. I made an document load method and pasted this code in there. Now it works!

Awesome!!

commented

Same happened to me, my problem was that i forgot to add
"//= require jquery.turbolinks" into my application.js folder.