Last active
September 6, 2017 10:35
-
-
Save ihorduchenko/4c1ca89ab804deee93007f98619a2f70 to your computer and use it in GitHub Desktop.
Filter portfolio items through hash
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
function filterPortfolio() { | |
var hash = window.location.hash.substring(1); | |
var $portItem = $(".tag-block"); | |
var $filter = $(".filter-tabs li a"); | |
if (hash) { | |
$filter.parent().removeClass("is-active"); | |
$portItem.removeClass("animate is-show").hide(); | |
$portItem | |
.filter("[data-tags~='" + hash + "']") | |
.addClass("is-show") | |
.show(); | |
$filter | |
.filter("[href~='#" + hash + "']") | |
.parent().addClass("is-active") | |
} | |
} | |
filterPortfolio(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment