Created
July 25, 2013 10:48
-
-
Save cblanquera/6078641 to your computer and use it in GitHub Desktop.
isotope soft hard search results logic
This file contains 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
$('#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