so I have scoured stackoverflow and found some similar articles but nothing has worked for me yet. I am creating a rails app and I want to use the Masonry for my layout. I have tried uploading the js as described in this post, but I could not get it to work no matter how many times I tried (yes I matched all the correct IDs and classes). I know the gem is working because the CSS is loading fine, I just cant get the JS to work. Here is what I have at the moment
Gemfile:
# masonry layout
gem 'masonry-rails'
application.js:
//= require jquery
//= require jquery_ujs
//= require turbolinks
//= require bootstrap
//= require_tree .
//= require masonry/jquery.masonry
index.html.erb:
<div class="center">
<div id="masonry-container" class="transitions-enabled infinite-scroll clearfix">
<%= render @products %>
</div>
<div class="paginator">
<%= will_paginate @products, renderer: BootstrapPagination::Rails %>
</div>
</div>
_products.html.erb
<div class="box">
<% gfyid = product.gfy.to_s.gsub("http://gfycat.com/", "") %>
<h2><%= product.name %></h2>
<div class="gfySize">
<div class="gfyitem" data-title=false data-autoplay=false data-controls=false data-expand=false data-id="<%= gfyid %>"></div>
</div>
I am so lost, I have been working on this for hours trying everything. The CSS is working/looking fine but I am just struggling with the js. Would appreciate any help thank you so much!
Try installing it manually, putting the masonry file in the vendors folder and writing the code in the product.js section.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With