Skip to content

Instantly share code, notes, and snippets.

@cblanquera
Created July 25, 2013 10:48
Show Gist options
  • Save cblanquera/6078641 to your computer and use it in GitHub Desktop.
Save cblanquera/6078641 to your computer and use it in GitHub Desktop.
isotope soft hard search results logic
$('#agency-search-form').submit(function(e) {
e.preventDefault();
var agencies = [];
$('div.select-agency li input:checked').each(function() {
agencies.push(this.value);
});
var filter = [];
$('div.select-specialism li input:checked, '
+'div.select-industry li input:checked, '
+'div.select-country li input:checked').each(function() {
filter.push(this.value);
});
//now form selector
var selector = [];
for(var i = 0; i < agencies.length; i++) {
if(filter.length == 0) {
selector.push('.'+agencies[i]);
continue;
}
selector.push('.'+agencies[i]+'.'+filter.join('.'))
}
selector = selector.join(', ');
$('div.logos').isotope({ filter: selector });
return false;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment