-
-
Save 7iomka/6c77c22e307685d55f2ded5cc7509949 to your computer and use it in GitHub Desktop.
mixItUp_filter_hash.js
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
jQuery(document).ready(function(){ | |
if (window.location.hash) { | |
var hashdata = new Object(); | |
jQuery.each(window.location.hash.replace(/^#/,'').split('&'), function(i, t){ | |
var s = t.split('='); | |
hashdata[s[0].toLowerCase()] = s[1].toLowerCase(); | |
}); | |
var $filters = jQuery('div[id^="Filters"]').find('li'); | |
// iterate hashes | |
jQuery.each( hashdata, function( key, value ) { | |
console.log("hash " + key + " : " + value); | |
// try this hash on each filter | |
$filters.each( function() { | |
var $t = jQuery(this); | |
var this_text = $t.text().toLowerCase(); | |
console.log("check filter: " + this_text + " against " + hashdata[key]); | |
if ( this_text == hashdata[key] ) { | |
$t.click(); | |
return false; | |
} | |
}); // $filters.each | |
}); // each hashdata | |
} // if window.location.hash | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment