Advertisement
asadsuman

Shufflescript

Apr 19th, 2017
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. $(window).on('load', function () {
  2.  
  3. $('.portfolio-container').each(function(i, e){
  4.  
  5. var ttGrid = $(this).find('.portfolio');
  6. var self = this;
  7. ttGrid.shuffle({
  8. itemSelector: '.portfolio-item' // the selector for the items in the grid
  9. });
  10.  
  11. /* reshuffle when user clicks button filter item */
  12. $(this).find('.portfolio-filter li').on('click',function (e) {
  13. e.preventDefault();
  14.  
  15. // set active class
  16. $(self).find('.portfolio-filter li').removeClass('active');
  17. $(this).addClass('active');
  18.  
  19. // get group name from clicked item
  20. var ttGroupName = $(this).attr('data-group');
  21.  
  22. // reshuffle grid
  23. ttGrid.shuffle('shuffle', ttGroupName);
  24. });
  25.  
  26. });
  27.  
  28. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement