Isotope Pagination with load more

Lau*_*hes 2 jquery jquery-pagination jquery-isotope isotope

I used the isotope from the site http://isotope.metafizzy.co/ and implemented a method to use load more items by pressing a button. The problem is that when i hide the elements to display only the initial number of elements, my isotope grid won't scale. If i press the show more button, the layout accurately scales.

It seems that

  $grid.isotope('hideItemElements', $(this)).isotope('layout');
Run Code Online (Sandbox Code Playgroud)

but

 $grid.isotope('revealItemElements', $(this)).isotope('layout');
Run Code Online (Sandbox Code Playgroud)

效果很好。你能告诉我我在做什么错吗?

这是Codepan中的一个演示:http ://codepen.io/laura-chesches/pen/RKPWGo

Lau*_*hes 5

我设法解决了自己的问题,并使功能加载更多(显示更多)按钮。这是工作代码:

http://codepen.io/laura-chesches/pen/xgEOpY

似乎我不应该使用rangingComplete事件,我只需要创建一个新的函数即可:

 var itemElems = $grid.isotope('getFilteredItemElements');
Run Code Online (Sandbox Code Playgroud)