Skip to content

Instantly share code, notes, and snippets.

@tarto-dev
Created February 13, 2014 15:00
Show Gist options
  • Save tarto-dev/8976523 to your computer and use it in GitHub Desktop.
Save tarto-dev/8976523 to your computer and use it in GitHub Desktop.
jQuery(function($){
$('#Grid').mixitup({
onMixLoad: function(){
var hash = window.location.hash;
var noHash=hash.replace("#","");
if(hash){
$('#Grid').mixitup('filter', noHash);
}
}
});
// EDIT CONFS
var filter_btn = $('.mixitup-filter-theme-expand');
var filters_to_show = 5;
var filter = $('.mixitup-filters-tech li');
var hidden_class = 'mixitup-hidden-filters';
var btn_plus = '(+)', btn_minus = '(-)';
var effect_speed = 'fast';
// DO NOT TOUCH UNDER THIS HELL CAUTION
var hash = window.location.hash;
if(!hash){
filter.each(function(i){
if(i > filters_to_show){
$(this).hide();
$(this).addClass(hidden_class);
}
});
} else {
filter_btn.html(btn_minus);
}
var hiddens = 1;
filter_btn.live('click', function(){
hiddens = $('.'+hidden_class).length;
if(hiddens == 0) {
filter.each(function(i){
if(i > filters_to_show){
$(this).fadeOut(effect_speed, function(){
filter_btn.html(btn_plus);
$(this).addClass(hidden_class);
});
}
});
} else {
$('.'+hidden_class).each(function(){
$(this).fadeIn(effect_speed, function(){
filter_btn.html(btn_minus);
$(this).removeClass(hidden_class);
});
});
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment