Created
September 17, 2018 19:21
-
-
Save chrdesigner/1b8b7d8d9ae6d7dae5e2df3471b15a8e to your computer and use it in GitHub Desktop.
Sub Menu + Filter TAG ~ External
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
$('.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