<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Maze of Minds &#187; jQuery</title>
	<atom:link href="/tag/jquery/feed/" rel="self" type="application/rss+xml" />
	<link>https://mazeofminds.com</link>
	<description>Blog About Web Design &#38; Development</description>
	<lastBuildDate>Thu, 30 Aug 2012 05:21:38 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Eye-Catching Navigation Menu with jQuery</title>
		<link>https://mazeofminds.com/744/eye-catching-navigation-menu-jquery/</link>
		<comments>https://mazeofminds.com/744/eye-catching-navigation-menu-jquery/#comments</comments>
		<pubDate>Mon, 09 Jan 2012 11:15:29 +0000</pubDate>
		<dc:creator>Asta</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">https://mazeofminds.com/?p=744</guid>
		<description><![CDATA[<p>In this short tutorial we are going to build a nice and eye-catching animated navigation menu with the help of jQuery. We will need hoverIntent and BackgroundPosition jQuery plugins, as well as sprite image for our menu items.</p> <p>Source &#187; Demo &#187;</p> <p>Let&#8217;s start with the markup.</p> The Markup <p>To keep semantic code our menu is organized as a simple unordered list:</p> <p>Our list items will only be displaying images (with CSS sprite method) but we do not want to... <a href="/744/eye-catching-navigation-menu-jquery/" title="Continue Reading the Post" class="read-more-link"> Read more<span class="read-more-prep">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<div class="full-image"><img src="/wp-content/uploads/jQuery_navigation_menu.png" alt="jQuery Navigation Menu" title="jQuery_navigation_menu" width="460" height="220" class="alignnone size-full wp-image-776" /></div>
<p>In this short tutorial we are going to build a nice and eye-catching animated navigation menu with the help of jQuery. We will need <a href="http://cherne.net/brian/resources/jquery.hoverIntent.html" title="hoverIntent jQuery Plugin">hoverIntent</a> and <a href="http://archive.plugins.jquery.com/project/backgroundPosition-Effect" title="BackgroundPosition Plugin">BackgroundPosition</a> jQuery plugins, as well as sprite image for our menu items.<span id="more-744"></span></p>
<p><a class="download-btn" href="/wp-content/uploads/source_jquery_menu.zip">Source &raquo;</a> <a class="demo-btn" href="/demo/jquery-navigation-menu/">Demo &raquo;</a></p>
<p>Let&#8217;s start with the markup.</p>
<h3>The Markup</h3>
<p>To keep semantic code our menu is organized as a simple unordered list:</p>
<pre class="brush: xml; title: ; notranslate">&lt;ul&gt;
  &lt;li id=&quot;articles&quot;&gt;&lt;a href=&quot;#&quot;&gt;&lt;span&gt;Articles&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
  &lt;li id=&quot;events&quot;&gt;&lt;a href=&quot;#&quot;&gt;&lt;span&gt;Events&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
  &lt;li id=&quot;shop&quot;&gt;&lt;a href=&quot;#&quot;&gt;&lt;span&gt;Shop&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
  &lt;li id=&quot;about&quot;&gt;&lt;a href=&quot;#&quot;&gt;&lt;span&gt;About&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
  &lt;li id=&quot;contact&quot;&gt;&lt;a href=&quot;#&quot;&gt;&lt;span&gt;Contact&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</pre>
<p>Our list items will only be displaying images (with CSS sprite method) but we do not want to leave them blank because of search engines. So we add a span inside the anchor tag of each list item. We will hide those spans form the user&#8217;s view in our stylesheet. We also assign an <em>id</em> to each list item for later use in CSS and jQuery.</p>
<h3>The CSS</h3>
<p>We will use CSS sprite method for our menu items.</p>
<div class="full-image"><img src="/wp-content/uploads/744_sprite_image.jpg" alt="Sprite Image" title="744_sprite_image" width="460" height="294" class="alignnone size-full wp-image-756" /></div>
<p>We load a single background image for all of our menu items and then give individual ones their own coordinates. The <em>id</em> that we assigned to each list item earlier allows us to target each item individually.</p>
<pre class="brush: css; title: ; notranslate">ul { list-style: none; margin: 0 auto; }
ul li a { display: block; height: 42px; background: url(../images/nav.png) 0 0 no-repeat; }
#articles a { background-position: 0 0; }
#events a { background-position: 0 -42px; }
#shop a { background-position:0 -84px; }
#about a { background-position:0 -126px; }
#contact a { background-position:0 -168px; }</pre>
<p>Finally, let&#8217;s add some jQuery magic.</p>
<h3>The jQuery</h3>
<p>First, we include the latest version of jQuery library and necessary plugins in our html document:</p>
<pre class="brush: xml; title: ; notranslate">&lt;script type=&quot;text/javascript&quot; src=&quot;js/jquery-1.7.1.min.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;js/jquery.hoverIntent.minified.js&quot;&gt;&lt;/script&gt; 
&lt;script type=&quot;text/javascript&quot; src=&quot;js/jquery.backgroundPosition.js&quot;&gt;&lt;/script&gt;</pre>
<p><a href="http://cherne.net/brian/resources/jquery.hoverIntent.html" title="hoverIntent jQuery Plugin">hoverIntent</a> jQuery plugin attempts to determine the user&#8217;s intent. It was derived and works like jQuery&#8217;s built-in <a href="http://api.jquery.com/hover/" title="jQuery Hover">hover</a>. However, instead of immediately calling the onMouseOver function, it waits until the user&#8217;s mouse slows down enough before making the call. Thus it delays or prevents the accidental firing of animations.</p>
<p>The other jQuery plugin, <a href="http://archive.plugins.jquery.com/project/backgroundPosition-Effect" title="BackgroundPosition Plugin">BackgroundPosition</a>, adds the ability to do background-position animations since animating multi-value properties like <em>background-position</em> is not supported in jQuery by default.</p>
<p>Next when the document is loaded we call <em>hoverIntent</em> method on our menu items. As with jQuery built-in <em>hover</em>, we need to define two functions. First will execute when the mouse pointer enters the element and the second when the mouse pointer leaves the element.</p>
<p>When the mouse pointer enters menu item we animate the horizontal position of its background image to the left. We repeat animation for several times to create a nice bouncing effect. When the mouse pointer leaves menu item we return its background image to the original position and again we repeat animation for several times to achieve a bouncing effect.</p>
<pre class="brush: jscript; title: ; notranslate">$(document).ready(function(){
  $('li').hoverIntent(
    function(){
      navitem = $(this);
      if (navitem.attr('id')==='articles'){ypos1=0;}
      else if (navitem.attr('id')==='events'){ypos1=-42;}
      else if (navitem.attr('id')==='shop'){ypos1=-84;}
      else if (navitem.attr('id')==='about'){ypos1=-126;}
      else {ypos1=-168;}
      navitem.children('a').stop().animate(
      {backgroundPosition:'-150px '+ypos1+'px'}, 220, 
      function(){
        navitem.children('a').animate( 
        {backgroundPosition:'-137px '+ypos1+'px'}, 64, 
        function(){
          navitem.children('a').animate( 
          {backgroundPosition:'-140px '+ypos1+'px'}, 32);
        });
      });
    }, 
    function(){
      navitem2 = $(this);
      if (navitem2.attr('id')==='articles'){ypos2=0;}
      else if (navitem2.attr('id')==='events'){ypos2=-42;}
      else if (navitem2.attr('id')==='shop'){ypos2=-84;}
      else if (navitem2.attr('id')==='about'){ypos2=-126;}
      else {ypos2=-168;}
      navitem2.children('a').stop().animate( 
      {backgroundPosition:'6px '+ypos2+'px'}, 220, 
      function(){
        navitem2.children('a').animate( 
        {backgroundPosition:'-3px '+ypos2+'px'}, 64, 
        function(){
          navitem2.children('a').animate( 
          {backgroundPosition:'0 '+ypos2+'px'}, 32);
        });
      });
    }
  );
});</pre>
<p>By this point our animated navigation menu is finished. Feel free to modify it according to your needs and use it to spice up your own websites. :)</p>
<p><a href="http://twitter.com/MazeofMinds" title="Twitter">Follow us on Twitter</a>, or <a href="http://feeds.feedburner.com/MazeOfMinds" title="Subscribe to Articles Feed" class="rss">subscribe to MazeofMinds RSS Feed</a> for more tutorials and posts.</p>
]]></content:encoded>
			<wfw:commentRss>https://mazeofminds.com/744/eye-catching-navigation-menu-jquery/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Plugins, Templates &amp; Frameworks For Responsive Web Design</title>
		<link>https://mazeofminds.com/713/plugins-templates-frameworks-for-responsive-web-design/</link>
		<comments>https://mazeofminds.com/713/plugins-templates-frameworks-for-responsive-web-design/#comments</comments>
		<pubDate>Sat, 07 Jan 2012 16:26:15 +0000</pubDate>
		<dc:creator>Tomas</dc:creator>
				<category><![CDATA[Freebies]]></category>
		<category><![CDATA[Resources]]></category>
		<category><![CDATA[Free]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">https://mazeofminds.com/?p=713</guid>
		<description><![CDATA[<p>In this post you will find useful frameworks and plugins which will help you to build responsive websites faster.</p> jQuery Plugins Blueberry <p>Blueberry is an experimental opensource jQuery image slider plugin which has been written specifically to work with fluid/responsive web layouts.</p> Response JS <p>Response JS is a lightweight jQuery plugin that gives web designers tools for building performance-optimized, mobile-first responsive websites. It provides semantic ways to dynamically swap code blocks based on breakpoints and serve images (or other media)... <a href="/713/plugins-templates-frameworks-for-responsive-web-design/" title="Continue Reading the Post" class="read-more-link"> Read more<span class="read-more-prep">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>In this post you will find useful frameworks and plugins which will help you to build responsive websites faster.<span id="more-713"></span></p>
<h3>jQuery Plugins</h3>
<div class="full-image"><a href="http://marktyrrell.com/labs/blueberry/"><img class="alignnone size-full wp-image-718" title="Blueberry" src="/wp-content/uploads/Blueberry.png" alt="Blueberry jQuery" width="460" height="220" /></a></div>
<h3><a title="The Semantic Grid System" href="http://marktyrrell.com/labs/blueberry/"><strong>Blueberry</strong></a></h3>
<p>Blueberry is an experimental opensource jQuery image slider plugin which has been written specifically to work with fluid/responsive web layouts.</p>
<div class="full-image"><a href="http://responsejs.com/"><img class="alignnone size-full wp-image-721" title="Response_Js" src="/wp-content/uploads/Response_Js.png" alt="Response.js" width="460" height="220" /></a></div>
<h3><a title="The Semantic Grid System" href="http://marktyrrell.com/labs/blueberry/"><strong>Response JS</strong></a></h3>
<p>Response JS is a lightweight jQuery plugin that gives web designers tools for building performance-optimized, mobile-first responsive websites. It provides semantic ways to dynamically swap code blocks based on breakpoints and serve images (or other media) progressively via HTML5 data attributes. Its object methods give developers hooks for triggering responsive actions and booleans for testing responsive properties.</p>
<div class="full-image"><a href="http://fittextjs.com/"><img class="alignnone size-full wp-image-723" title="FitText_Js" src="/wp-content/uploads/FitText_Js.png" alt="FitText.js" width="460" height="220" /></a></div>
<h3><a title="The Semantic Grid System" href="http://marktyrrell.com/labs/blueberry/"><strong>Fittext.js</strong></a></h3>
<p>FitText makes font-sizes flexible. Use this plugin on your fluid or responsive layout to achieve scalable headlines that fill the width of a parent element.</p>
<div class="full-image"><a href="http://fitvidsjs.com/"><img class="alignnone size-full wp-image-725" title="FitVids_Js" src="/wp-content/uploads/FitVids_Js.png" alt="FitVids.js" width="460" height="220" /></a></div>
<h3><a title="The Semantic Grid System" href="http://marktyrrell.com/labs/blueberry/"><strong>FitVids.js</strong></a></h3>
<p>A lightweight, easy-to-use jQuery plugin for fluid width video embeds.</p>
<h3>Templates &amp; Frameworks</h3>
<div class="full-image"><a href="http://stuffandnonsense.co.uk/projects/320andup/"><img class="alignnone size-full wp-image-727" title="320-and-up" src="/wp-content/uploads/320-and-up.png" alt="320 and Up" width="460" height="220" /></a></div>
<h3><a title="The Semantic Grid System" href="http://marktyrrell.com/labs/blueberry/"><strong>320 and Up</strong></a></h3>
<p>‘320 and Up’ starts with a tiny screen stylesheet that contains only reset, colour and typography styles. Media Queries then load assets and layout styles progressively and only as they’re needed. Think of this as responsible responsive design. ‘320 and Up’ is a device agnostic, one web boilerplate.</p>
<div class="full-image"><a href="http://www.amazium.co.uk/"><img class="alignnone size-full wp-image-729" title="Amazium" src="/wp-content/uploads/Amazium.png" alt="Amazium Framework " width="460" height="220" /></a></div>
<h3><a title="The Semantic Grid System" href="http://marktyrrell.com/labs/blueberry/"><strong>Amazium</strong></a></h3>
<p>Responsive framework based on 960 grid system.</p>
<div class="full-image"><a href="http://foundation.zurb.com/"><img class="alignnone size-full wp-image-730" title="Foundation" src="/wp-content/uploads/Foundation.png" alt="Foundation Zurb" width="460" height="220" /></a></div>
<h3><a title="The Semantic Grid System" href="http://marktyrrell.com/labs/blueberry/"><strong>Foundation</strong></a></h3>
<p>An easy to use, powerful, and flexible framework for building prototypes and production code on any kind of device.</p>
<div class="full-image"><a href="http://csswizardry.com/inuitcss/"><img class="alignnone size-full wp-image-732" title="inuit.css" src="/wp-content/uploads/inuit.css.png" alt="inuit css framework " width="460" height="220" /></a></div>
<h3><a title="The Semantic Grid System" href="http://marktyrrell.com/labs/blueberry/"><strong>Inuit.css</strong></a></h3>
<p>Inuit.css framework is built to work on smaller screens (such as tablets) and tiny screens (such as phones) straight out of the box with minimal effort.</p>
<div class="full-image"><a href="http://constellationtheme.com/"><img class="alignnone size-full wp-image-733" title="freamwork" src="/wp-content/uploads/freamwork.png" alt="Constellation WordPress Theme" width="460" height="220" /></a></div>
<h3><a title="The Semantic Grid System" href="http://marktyrrell.com/labs/blueberry/"><strong>The Constellation WordPress Theme</strong></a></h3>
<p>The Constellation theme is the perfect starting point for any WordPress project. It gives you the flexibility to provide bespoke styles for different devices, totally up-to-date HTML5 code which is fantastic for SEO, a flexible grid system on top of all the other goodness bundled in to the HTML5 boiler plate.</p>
<div class="full-image"><a href="http://themefortress.com/reverie/"><img class="alignnone size-full wp-image-734" title="Reverie" src="/wp-content/uploads/Reverie.png" alt="Reverie WordPress Theme" width="460" height="220" /></a></div>
<h3><a title="The Semantic Grid System" href="http://themefortress.com/reverie/"><strong>Reverie</strong></a></h3>
<p>Reverie Framework is an extremely versatile HTML5 WordPress framework based on ZURB&#8217;s Foundation, a powerful tool for building prototypes on any kind of devices.</p>
<div class="full-image"><a href="http://www.getskeleton.com/"><img class="alignnone size-full wp-image-735" title="Skeleton" src="/wp-content/uploads/Skeleton.png" alt="Skeleton Framework " width="460" height="220" /></a></div>
<h3><a title="The Semantic Grid System" href="http://www.getskeleton.com/"><strong>Skeleton</strong></a></h3>
<p>Skeleton is a small collection of CSS &amp; JS files that can help you rapidly develop sites that look beautiful at any size, be it a 17&#8243; laptop screen or an iPhone.</p>
<div class="full-image"><a href="http://thatcoolguy.github.com/gridless-boilerplate/"><img class="alignnone size-full wp-image-736" title="Gridless" src="/wp-content/uploads/Gridless1.png" alt="Gridless Boilerplate" width="460" height="220" /></a></div>
<h3><a title="The Semantic Grid System" href="http://www.getskeleton.com/"><strong>Gridless</strong></a></h3>
<p>Gridless is an optionated HTML5 and CSS3 boilerplate for making mobile first responsive, cross-browser websites with beautiful typography.</p>
<div class="full-image"><a href="http://simplegrid.info/"><img class="alignnone size-full wp-image-739" title="SimpleGrid" src="/wp-content/uploads/SimpleGrid.png" alt="Simple Grid" width="460" height="220" /></a></div>
<h3><a title="The Semantic Grid System" href="http://www.getskeleton.com/"><strong>Simple Grid</strong></a></h3>
<p>SG is prepared for 4 distinct ranges of screen size: screens 720px, screens 720px, screens than 985px, and screens than 1235px. This means that people visiting your site will receive a layout that&#8217;s tuned to the size of their browser window.</p>
<div class="full-image"><a href="http://cssgrid.net/"><img class="alignnone size-full wp-image-738" title="The-1140px-CSS-Grid-System" src="/wp-content/uploads/The-1140px-CSS-Grid-System.png" alt="The 1140px CSS Grid System" width="460" height="220" /></a></div>
<h3><a title="1140 CSS Grid" href="http://cssgrid.net/" target="_blank"><strong>The 1140 grid</strong></a></h3>
<p>The 1140 grid fits perfectly into a 1280 monitor. On smaller monitors it becomes fluid and adapts to the width of the browser.<br />
Beyond a certain point it uses media queries to serve up a mobile version, which essentially stacks all the columns on top of each other so the flow of information still makes sense.</p>
<div class="full-image"><a href="http://goldilocksapproach.com/"><img class="alignnone size-full wp-image-787" title="The Goldilocks Approach" src="/wp-content/uploads/The-Goldilocks-Approach.png" alt="CSS and HTML boilerplate" width="460" height="220" /></a></div>
<h3><a title="The Goldilocks Approach" href="http://goldilocksapproach.com/"><strong>The Goldilocks Approach</strong></a></h3>
<p>CSS and HTML boilerplate <strong>Goldilocks Approach</strong> uses a combination of Ems, Max-Width, Media Queries and Pattern Translations to consider just three states that allow your designs to be resolution independent.</p>
<div class="full-image"><a href="http://gridpak.com/"><img class="alignnone size-full wp-image-791" title="Gridpak - the responsive grid generator" src="/wp-content/uploads/Gridpak.png" alt="The Responsive Grid Generator" width="460" height="220" /></a></div>
<h3><a title="Gridpak" href="http://gridpak.com/"><strong>Gridpak &#8211; The Responsive Grid Generator</strong></a></h3>
<p><strong>Gridpak</strong> is the starting point for your responsive projects, improving your workflow and saving time. Create your responsive grid system once using the simple interface and let Gridpak do the heavy lifting by generating PNGs, CSS and JavaScript.</p>
<div class="full-image"><a href="http://www.designlunatic.com/projects/blucss/index.html"><img class="alignnone size-full wp-image-798" title="BluCSS" src="/wp-content/uploads/BluCSS.png" alt="BluCSS " width="460" height="220" /></a></div>
<h3><a title="Gridpak" href="http://www.designlunatic.com/projects/blucss/index.html"><strong>BluCSS</strong></a></h3>
<p><strong>BluCSS</strong> is a CSS framework designed with ease of use and simplicity in mind. It is specifically made so that when you&#8217;re working on your next project, you don&#8217;t have to worry about the essentials. With BluCSS, you can be up and running in less than a minute. One feature that stands out in this framework is responsive image functionality. Just apply any &#8220;blu_&#8221; class to an image, same as any other element, and the image will automatically be resized according to the browser width.</p>
]]></content:encoded>
			<wfw:commentRss>https://mazeofminds.com/713/plugins-templates-frameworks-for-responsive-web-design/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Create a Filterable Portfolio Powered by jQuery</title>
		<link>https://mazeofminds.com/533/filterable-portfolio-powered-by-jquery/</link>
		<comments>https://mazeofminds.com/533/filterable-portfolio-powered-by-jquery/#comments</comments>
		<pubDate>Wed, 24 Aug 2011 18:16:11 +0000</pubDate>
		<dc:creator>Asta</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">https://mazeofminds.com/?p=533</guid>
		<description><![CDATA[<p>In this tutorial I will show you how to create a filterable portfolio using jQuery. The idea is to display all of your work in a single page that would have a filtering option allowing visitors to filter portfolio items by category. Limiting your portfolio to a single page helps to display all the portfolio items quickly and effectively and the filter makes it easy to navigate. </p> <p>To filter portfolio items we will use Quicksand plugin. Additionally, we will... <a href="/533/filterable-portfolio-powered-by-jquery/" title="Continue Reading the Post" class="read-more-link"> Read more<span class="read-more-prep">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<div class="full-image"><img class="alignnone size-full wp-image-549" title="filterable-portfolio-0824" src="/wp-content/uploads/filterable-portfolio-0824.jpg" alt="Filterable Portfolio Powered by jQuery" width="460" height="220" /></div>
<p>In this tutorial I will show you how to create a filterable portfolio using jQuery. The idea is to display all of your work in a single page that would have a filtering option allowing visitors to filter portfolio items by category. Limiting your portfolio to a single page helps to display all the portfolio items quickly and effectively and the filter makes it easy to navigate. <span id="more-533"></span></p>
<p>To filter portfolio items we will use <a title="Quicksand plugin" href="http://razorjack.net/quicksand/">Quicksand plugin</a>. Additionally, we will need <a title="Easing plugin" href="http://gsgd.co.uk/sandbox/jquery/easing/">Easing Plugin</a> to give advanced easing options and <a title="PrettyPhoto plugin" href="http://www.no-margin-for-errors.com/projects/prettyphoto-jquery-lightbox-clone/">PrettyPhoto plugin</a> to view full-size protfolio items.</p>
<p>The beautiful photos used in the demo are from the portfolio of fashion and beauty photographer <a title="Yulia Gorbachenko" href="http://www.yuliagorbachenko.com/">Yulia Gorbachenko</a>.</p>
<p><a class="download-btn" href="/wp-content/uploads/mofm-fp-source.zip">Source »</a> <a class="demo-btn" href="/demo/filterable-portfolio/">Demo »</a></p>
<h3>The Markup</h3>
<p>Say we have a number of photos in our portfolio and they can be classified in these categories: Beauty, Hannah, On Fire, Traction, Wavelength or Hair. Let&#8217;s create a category filter to navigate through our photos. A simple unordered list will perfectly work:</p>
<pre class="brush: xml; title: ; notranslate">&lt;ul class=&quot;filter&quot;&gt;
  &lt;li class=&quot;current all&quot;&gt;&lt;a href=&quot;#&quot;&gt;All&lt;/a&gt;&lt;/li&gt;
  &lt;li class=&quot;beauty&quot;&gt;&lt;a href=&quot;#&quot;&gt;Beauty&lt;/a&gt;&lt;/li&gt;
  &lt;li class=&quot;hannah&quot;&gt;&lt;a href=&quot;#&quot;&gt;Hannah&lt;/a&gt;&lt;/li&gt;
  &lt;li class=&quot;onfire&quot;&gt;&lt;a href=&quot;#&quot;&gt;On Fire&lt;/a&gt;&lt;/li&gt;
  &lt;li class=&quot;traction&quot;&gt;&lt;a href=&quot;#&quot;&gt;Traction&lt;/a&gt;&lt;/li&gt;
  &lt;li class=&quot;wavelength&quot;&gt;&lt;a href=&quot;#&quot;&gt;Wavelength&lt;/a&gt;&lt;/li&gt;
  &lt;li class=&quot;hair&quot;&gt;&lt;a href=&quot;#&quot;&gt;Hair&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</pre>
<p>We assign classes equal to the category name to each list item for later use in jQuery. Additionally, we add one more list item &#8220;All&#8221; to view all portfolio items. We also assign the class <code>"current"</code> to this item because we want to show all portfolio items in the default view.</p>
<p>Now when we have our filter let&#8217;s move on and create one more list to hold our portfolio items:</p>
<pre class="brush: xml; title: ; notranslate">&lt;ul class=&quot;portfolio&quot;&gt;
  &lt;li data-id=&quot;id-1&quot; data-type=&quot;hannah&quot;&gt;
    &lt;a href=&quot;images/hannah_yg.jpg&quot; rel=&quot;prettyPhoto[portfolio]&quot;&gt;
      &lt;img src=&quot;images/hannah_yg_thumb.jpg&quot; /&gt;
    &lt;/a&gt;
  &lt;/li&gt;
  &lt;li data-id=&quot;id-2&quot; data-type=&quot;hair&quot;&gt;
    &lt;a href=&quot;images/bianca_yg.jpg&quot; rel=&quot;prettyPhoto[portfolio]&quot;&gt;
      &lt;img src=&quot;images/bianca_yg_thumb.jpg&quot; /&gt;
    &lt;/a&gt;
  &lt;/li&gt;
  &lt;li data-id=&quot;id-3&quot; data-type=&quot;traction&quot;&gt;
    &lt;a href=&quot;images/heather_yg.jpg&quot; rel=&quot;prettyPhoto[portfolio]&quot;&gt;
      &lt;img src=&quot;images/heather_yg_thumb.jpg&quot; /&gt;
    &lt;/a&gt;
  &lt;/li&gt;
  ...
&lt;/ul&gt;</pre>
<p>Each list item contains the thumbnail image with an anchor tag around it. The anchor&#8217;s <code>href</code> attribute defines the URL of the full-size image and the <code>rel</code> attribute is necessary for the PrettyPhoto plugin that we will use later.</p>
<p>You may have also noticed that every list item has <code>data-id</code> and <code>data-type</code> attributes. Both are necessary for the Quicksand plugin. <code>data-id</code> is a unique identifier and <code>data-type</code> defines the category to which the portfolio item is assigned. Note that <code>data-*</code> is a perfectly valid HTML5 attribute.</p>
<h3>The CSS</h3>
<p>This isn&#8217;t a tutorial on CSS, so I won&#8217;t go into great detail about how to style the gallery. You can see my stylesheet in the source files attached to this post. I would just like to note that I have used several selectors and properties that are not supported in the earlier versions of IE.</p>
<h3>The jQuery</h3>
<p>First, we include the latest version of jQuery library and necessary plugins in the head of our document. For the prettyPhoto plugin we also need to include prettyPhoto stylesheet that comes with the plugin:</p>
<pre class="brush: xml; title: ; notranslate">&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;css/prettyPhoto.css&quot;/&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;js/jquery-1.6.2.min.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;js/jquery.quicksand.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;js/jquery.prettyPhoto.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;js/jquery.easing.1.3.js&quot;&gt;&lt;/script&gt;</pre>
<p>Next, when the document is loaded we initialize the prettyPhoto plugin. The prettyPhoto plugin accepts a number of parameters so you can easily customize it:</p>
<pre class="brush: jscript; title: ; notranslate">$(document).ready(function(){
  $(&quot;.portfolio a[rel^='prettyPhoto']&quot;).prettyPhoto({
    theme:'light_square',
    autoplay_slideshow: false,
    overlay_gallery: false
  });</pre>
<p>Then we add some code to handle the Quicksand plugin:</p>
<pre class="brush: jscript; title: ; notranslate">var $portfolioClone = $(&quot;.portfolio&quot;).clone();
$(&quot;.filter a&quot;).click(function(e){
  $(&quot;.filter li&quot;).removeClass(&quot;current&quot;);
  var $filterClass = $(this).parent().attr(&quot;class&quot;);
  if ($filterClass == &quot;all&quot;) {
    var $filteredPortfolio = $portfolioClone.find(&quot;li&quot;);
  } else {
    var $filteredPortfolio = $portfolioClone.find(&quot;li[data-type~=&quot;+$filterClass+&quot;]&quot;);
  }</pre>
<p>Quicksand works by comparing two collections of items and replacing them with a nice shuffling animation. By appending <code>.clone()</code> to our portfolio list and assigning it to <code>$portfolioClone</code>, we get a copy of the original list items that we will use later.<br />
Once the link in the category filter is clicked, we want to remove the class <code>current</code> from the list item that has it and to determine which link has been clicked by taking the class value and assigning it to the <code>$filterClass</code>. In the case if the &#8220;All&#8221; link has been clicked, we want to show all of the portfolio items. Otherwise, we want to show only those list items that have <code>data-type</code> attribute with a value containing <code>$filterClass</code>.</p>
<pre class="brush: jscript; title: ; notranslate">    $(&quot;.portfolio&quot;).quicksand( $filteredPortfolio, {
      duration: 800,
      easing: 'easeInOutQuad'
    }, function(){
      $(&quot;.portfolio a[rel^='prettyPhoto']&quot;).prettyPhoto({
        theme:'light_square',
        autoplay_slideshow: false,
        overlay_gallery: false
      });
    });
    $(this).parent().addClass(&quot;current&quot;);
    e.preventDefault();
  })
});</pre>
<p>Finally, we call <code>quicksand</code>. <code>$filteredPortfolio</code> which was assigned in the if statement contains filtered portfolio items that are to be displayed instead of the original portfolio items. We can also specify how long the animation will take, the easing type for the animation (don&#8217;t forget to include <a title="Easing plugin" href="http://gsgd.co.uk/sandbox/jquery/easing/">jQuery Easing Plugin</a> for this) and other optional parameters. As the last argument we include a callback function to apply prettyPhoto on newly cloned portfolio items as well.</p>
<p>In the last lines of code we add the class <code>current</code> to the parent of the clicked link and call <code>preventDefault()</code> to prevent the browser jump to the link anchor.</p>
<p>With that our filterable portfolio is finished. I hope you enjoyed the tutorial and find it useful! I tried to explain everything as best as I can and if you have any questions, please feel free to ask.</p>
<p><a title="Twitter" href="http://twitter.com/MazeofMinds">Follow us on Twitter</a>, or <a class="rss" title="Subscribe to Articles Feed" href="http://feeds.feedburner.com/MazeOfMinds">subscribe to RSS Feed</a> for more tutorials and posts.</p>
]]></content:encoded>
			<wfw:commentRss>https://mazeofminds.com/533/filterable-portfolio-powered-by-jquery/feed/</wfw:commentRss>
		<slash:comments>92</slash:comments>
		</item>
	</channel>
</rss>
