Created
February 2, 2013 18:47
-
-
Save andyjbas/4698761 to your computer and use it in GitHub Desktop.
Revisions
-
andyjbas created this gist
Feb 2, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,26 @@ // grab new items html var newItems = "<%= j render(partial: 'endless_append', locals: { items: @feed_items }) %>"; // fetch the scroll position // used to set the window location back after below hack var scroll_position = $(window).scrollTop(); // append new items to isotope, as usual $("#feed_list").append( newItems ); // remove all isotope functionality // isotope is not otherwise detecting the existance of // the newely appended elements regardless of approach $("#feed_list").isotope("destroy"); // reloads isotope layout for entire page // after layout callback returns the window position // to the position before append was fired reloadIsotopeScroll(scroll_position); // reset pagination <% if @feed_items.next_page %> $('#paginateFeed .pagination').replaceWith('<%= j will_paginate(@feed_items) %>'); <% else %> $('#paginateFeed .pagination').remove(); <% end %>