www.gusucode.com > 200套html5精品模板76_100 > 097/js/portfolio-filter.js
$(document).ready(function(){ // Clone portfolio items to get a second collection for Quicksand plugin var $portfolioClone = $(".portfolio_Wrapper ul").clone(); // Attempt to call Quicksand on every click event handler $(".filter a").click(function(e){ $(".filter li").removeClass("current"); // Get the class attribute value of the clicked link var $filterClass = $(this).parent().attr("class"); if ( $filterClass == "all" ) { var $filteredPortfolio = $portfolioClone.find("li"); } else { var $filteredPortfolio = $portfolioClone.find("li[data-type~=" + $filterClass + "]"); } // Call quicksand $(".portfolio_Wrapper ul").quicksand( $filteredPortfolio, { duration: 800, easing: 'easeInOutQuad' }, function(){ // re-initialize portfolio hover effect portHover(); // re-adjust pole height adjustPole(); }); $(this).parent().addClass("current"); // Prevent the browser jump to the link anchor e.preventDefault(); }) });