I tried this using both files from the Freemasonry site and stone from stone, but I have the same problem.
Basically, when I resize the browser window, the fields do not move according to the new page size. Instead, I just get the scroll bars appearing in the browser.
I know that the files load normally and select the correct selectors, because if I, for example, change the column width in the masonry parameters (), when the page loads, the windows appear in another place.
In addition, I use Bootstrap, if relevant, but I called the selectors so that they do not interfere with those that were reserved for loading. using # masonry container instead of #container.
Any help would be greatly appreciated, thanks!
application.js:
//= require masonry/jquery.masonry
message_board / show:
<div id="show-message-board"> <%= render :partial => "show_message_board", :locals => { :messages => current_user.messages }, :remote => true %> </div> <script> $(function(){ $('#masonry-container').masonry({ </script>
_show_message_board.html.erb:
<div id="masonry-container" class="transitions-enabled infinite-scroll clearfix"> <% messages.each do |message| %> <div class="item"> <p class="message_from"><%= message.user.first_name %> <%= message.user.last_name %>:</p> <p class="message_content"><%= message.content %></p> </div> <% end %>
EDIT:
I tried using the following as suggested elsewhere, and this still doesn't work !:
$(function(){ var $container = $('#masonry-container'); $container.imagesLoaded( function(){ $container.masonry({ itemSelector : '.item' }); }); });
ruby-on-rails jquery-masonry
ecs
source share