Guest User

Untitled

a guest
Jan 23rd, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.01 KB | None | 0 0
  1. $the_portfolio.on('click', '.et_pb_portfolio_filter a', function(e){
  2. e.preventDefault();
  3. var category_slug = $(this).data('category-slug');
  4. var $the_portfolio = $(this).parents('.et_pb_filterable_portfolio');
  5. var $the_portfolio_items = $the_portfolio.find('.et_pb_portfolio_items');
  6.  
  7. if ( 'all' == category_slug ) {
  8. $the_portfolio.find('.et_pb_portfolio_filter a').removeClass('active');
  9. $the_portfolio.find('.et_pb_portfolio_filter_all a').addClass('active');
  10.  
  11. // remove all items from the portfolio items container
  12. $the_portfolio_items.empty();
  13.  
  14. // fill the portfolio items container with cached items from memory
  15. $the_portfolio_items.append( all_portfolio_items.find( '.et_pb_portfolio_item' ).clone() );
  16. $the_portfolio.find('.et_pb_portfolio_item').addClass('active');
  17. } else {
  18. $the_portfolio.find('.et_pb_portfolio_filter_all').removeClass('active');
  19. $the_portfolio.find('.et_pb_portfolio_filter a').removeClass('active');
  20. $the_portfolio.find('.et_pb_portfolio_filter_all a').removeClass('active');
  21. $(this).addClass('active');
  22.  
  23. // remove all items from the portfolio items container
  24. $the_portfolio_items.empty();
  25.  
  26. // fill the portfolio items container with cached items from memory
  27. $the_portfolio_items.append( all_portfolio_items.find( '.et_pb_portfolio_item.project_category_' + $(this).data('category-slug') ).clone() );
  28.  
  29. $the_portfolio_items.find('.et_pb_portfolio_item').removeClass('active');
  30. $the_portfolio_items.find('.et_pb_portfolio_item.project_category_' + $(this).data('category-slug') ).addClass('active').removeClass( 'inactive' );
  31. }
  32.  
  33. set_filterable_grid_items( $the_portfolio );
  34. setTimeout(function(){
  35. set_filterable_portfolio_hash( $the_portfolio );
  36. }, 500 );
  37.  
  38. $the_portfolio.find('.et_pb_portfolio_item').removeClass( 'first_in_row last_in_row' );
  39. et_pb_set_responsive_grid( $the_portfolio, '.et_pb_portfolio_item:visible' );
  40. });
Add Comment
Please, Sign In to add comment