Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Sub Menu + Filter TAG ~ External
$('.filterBlog a').on('click', function(e) {
filterBlogHash(this.hash, e);
});
$(window).on('load',function() {
filterBlogHash(window.location.hash);
});
function filterBlogHash(hash, e) {
if(hash === '') {
return false;
} else {
if($(hash).length > 0) {
if(typeof e !== 'undefined') {
e.preventDefault();
history.pushState(null, null, $(e.target).attr('href'));
}
var $retunrHash = window.location.hash.substring(1);
$('.filter a.type').each(function (index, value) {
if($retunrHash === $(this).attr('id')){
$(this).get(0).click();
}
});
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.