Created
January 13, 2018 18:25
-
-
Save FinalDestiny/7ac6ef32fb4bc67cc999e0981f86264a to your computer and use it in GitHub Desktop.
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 characters
$the_portfolio.on('click', '.et_pb_portfolio_filter a', function(e){ | |
e.preventDefault(); | |
var category_slug = $(this).data('category-slug'); | |
var $the_portfolio = $(this).parents('.et_pb_filterable_portfolio'); | |
var $the_portfolio_items = $the_portfolio.find('.et_pb_portfolio_items'); | |
if ( 'all' == category_slug ) { | |
$the_portfolio.find('.et_pb_portfolio_filter a').removeClass('active'); | |
$the_portfolio.find('.et_pb_portfolio_filter_all a').addClass('active'); | |
// remove all items from the portfolio items container | |
$the_portfolio_items.empty(); | |
// fill the portfolio items container with cached items from memory | |
$the_portfolio_items.append( all_portfolio_items.find( '.et_pb_portfolio_item' ).clone() ); | |
$the_portfolio.find('.et_pb_portfolio_item').addClass('active'); | |
} else { | |
$the_portfolio.find('.et_pb_portfolio_filter_all').removeClass('active'); | |
$the_portfolio.find('.et_pb_portfolio_filter a').removeClass('active'); | |
$the_portfolio.find('.et_pb_portfolio_filter_all a').removeClass('active'); | |
$(this).addClass('active'); | |
// remove all items from the portfolio items container | |
$the_portfolio_items.empty(); | |
// fill the portfolio items container with cached items from memory | |
$the_portfolio_items.append( all_portfolio_items.find( '.et_pb_portfolio_item.project_category_' + $(this).data('category-slug') ).clone() ); | |
$the_portfolio_items.find('.et_pb_portfolio_item').removeClass('active'); | |
$the_portfolio_items.find('.et_pb_portfolio_item.project_category_' + $(this).data('category-slug') ).addClass('active').removeClass( 'inactive' ); | |
} | |
set_filterable_grid_items( $the_portfolio ); | |
setTimeout(function(){ | |
set_filterable_portfolio_hash( $the_portfolio ); | |
}, 500 ); | |
$the_portfolio.find('.et_pb_portfolio_item').removeClass( 'first_in_row last_in_row' ); | |
et_pb_set_responsive_grid( $the_portfolio, '.et_pb_portfolio_item:visible' ); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment