I got inspiered by Makenzie Child video and github repo to create a masonry effect on my rails app.
I have a little problem, when I visit the page, the behavior is not the expected one, all the boxes are below each others, and if I reload they take the good behavior... I would like that the good behavior could display when we arrive on the page.
I don't know any javascript please dont be mad at me :)
this is the progresses.js.coffee
$ ->
$('#progresses').imagesLoaded ->
$('#progresses').masonry
itemSelector: '.box'
isFitWidth: true
application.js
//= require jquery
//= require bootstrap-sprockets
//= require jquery_ujs
//= require masonry/jquery.masonry
//= require turbolinks
//= require_tree .
views/progresses/index.html.slim
.container
.section
.row
.col-xs-12
h1.text-gold
|Work In Progress [
= @progresses.count
| ]
hr
#progresses.transitions-enabled
- @progresses.each do |progress|
.box.panel.panel-default
= link_to (image_tag progress.main_image.url), progress
.panel-body
h4.text-gold = progress.title.upcase
h5 = progress.date
small = truncate(progress.content, length: 150)
Thanks for your help,
regards