Advertisement
  1. Web Design
  2. HTML/CSS

Creating an Adaptive, Filterable Portfolio Using jQuery Isotope

Scroll to top
Read Time: 17 min

Today we'll be taking a PSD Portfolio layout from ThemeForest, replicating it entirely in HTML & CSS whilst making it adaptive. We'll then go further and integrate the Isotope jQuery plugin to make it a fully functional filterable portfolio.


Step 1: Organizing the Project

We'll start off by creating a simple project structure so everything is kept organized. We'll create three folders:

  • css - for our CSS files
  • images - all images will be placed in here
  • js - for our jQuery plugins and custom scripts


Step 2: Document

Before we get stuck into our coding we'll create the index.html file which can be placed in the root of your project. We'll throw in a basic HTML5 template, linking to our CSS file in the head. Additionally, we'll need to link to some more files:

  • jQuery Library - We'll need to link to the jQuery library ready for later on when we use the Isotope plugin, we'll go ahead and throw that in now. I've gone and used the library hosted by Google (highly recommended).
  • HTML5 Shiv - Since we'll be using HTML5 elements we'll need to make sure we link to the HTML5 Shiv to allow the elements to be recognized in older IE versions.
  • Google Web Fonts - If you look at the PSD you'll notice that the font PT Sans is used. Since this font won't be locally available for many users we'll link to it using the Google Web Fonts service.
1
 
2
<!DOCTYPE html> 
3
<html> 
4
<head> 
5
 
6
	<!--Meta tags--> 
7
	<meta charset="utf-8"> 
8
 
9
	<!--Title--> 
10
	<title>Hipstar Tutorial</title> 
11
		 
12
	<!--Stylesheets--> 
13
	<link rel="stylesheet" href="css/styles.css"> 
14
 
15
	<!--Google Web Fonts--> 
16
	<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=PT+Sans+Narrow|PT+Sans+Caption:400,700"> 
17
 
18
	<!--jQuery--> 
19
	<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> 
20
 
21
	<!--HTML5 Shiv--> 
22
	<!--[if lt IE 9]> 
23
			<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> 
24
	<![endif]--> 
25
	 
26
</head> 
27
<body> 
28
 
29
 
30
 
31
 
32
 
33
 
34
 
35
</body> 
36
</html>

Step 3: Adding General Styles

We'll now need some general styles in our CSS file. This will involve just a simple reset which you can add to the top of your CSS file.

1
 
2
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,and,address,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video,input,textarea,select{background:transparent;border:0;font-size:100%;margin:0;outline:0;padding:0;vertical-align:baseline}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}body{line-height:1}abbr[title],dfn[title]{border-bottom:1px dotted;cursor:help}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:none}del{text-decoration:line-through}hr{background:transparent;border:0;clear:both;color:transparent;height:1px;margin:0;padding:0}mark{background-color:#ffffb3;font-style:italic}input,select{vertical-align:middle}ins{background-color:red;color:white;text-decoration:none}ol,ul{list-style:none}table{border-collapse:collapse;border-spacing:0}a{text-decoration:none;} 
3
.clear{clear:both;display:block;height:0;overflow:hidden;visibility:hidden;width:0}.clearfix:after{clear:both;content:' ';display:block;font-size:0;height:0;line-height:0;visibility:hidden;width:0}* html .clearfix,:first-child+html .clearfix{zoom:1}

Step 4: Starting With the Header

Now we'll begin building the structure of the site! We'll start off with the header and do so by using the HTML5 Header element.

1
 
2
<header class="header clearfix"> 
3
	 
4
	 
5
</header>

Next we'll add some CSS for our header. We'll apply some basic styles here, but the main aspect to take into account is the positioning. Here we're using a position of fixed and then 0 on the top, left and right. This will ensure our header stays at the top of the window when scrolling - and that it fills the whole height of the browser.

1
 
2
.header { 
3
	height:69px; 
4
	background:url(../images/header.png) repeat; 
5
	border-bottom:1px solid #fff; 
6
	-webkit-box-shadow:0 0 7px rgba(0,0,0,.25); 
7
	-moz-box-shadow:0 0 7px rgba(0,0,0,.25); 
8
	box-shadow:0 0 7px rgba(0,0,0,.25); 
9
	position:fixed; 
10
	top:0; 
11
	left:0; 
12
	right:0; 
13
	z-index:101; 
14
}

Step 5: The Logo and "Hire Me" Badge

For simplicity's sake, both these parts will be carried out using images, but we'll also wrap them within anchor tags and give them a class so we can set some styles for positioning.

1
 
2
<header class="header clearfix"> 
3
	 
4
	<a href="#" class="logo"><img src="images/logo.png" alt="Hipstar"></a> 
5
 
6
	<a href="#" class="hire-me"><img src="images/hire_me.png" alt="Hire Me"></a> 
7
 
8
</header>

Both of these use similar styling, both positioned absolutely (the header being the parent) with a 0 top. The logo has left of 0 to keep it on the left and the hire-me badge a right of 20px to push it slightly off from the right.

1
 
2
.logo { 
3
	position:absolute; 
4
	top:0; 
5
	left:0; 
6
} 
7
 
8
.hire-me { 
9
	position:absolute; 
10
	top:0; 
11
	right:20px; 
12
}

You should have something that looks like this:



Step 6: The Sidebar

Once again we'll take advantage of HTML5's markup and create our sidebar using the aside element.

1
 
2
<aside class="sidebar clearfix"> 
3
 
4
 
5
</aside>

Onto the CSS for the sidebar, you'll notice that we've used position fixed again, technically this doesn't really apply here as the slider is going to fill the height of the page.

1
 
2
.sidebar { 
3
	width:149px; 
4
	position:fixed; 
5
	top:70px; 
6
	left:0; 
7
	bottom:0; 
8
	right:0; 
9
	z-index:1; 
10
	float:left; 
11
	border-right:1px solid #a13d36; 
12
	margin-right:-1px; 
13
	-webkit-box-shadow:inset -1px 0 0 #ff786b; 
14
	-moz-box-shadow:inset -1px 0 0 #ff786b; 
15
	box-shadow:inset -1px 0 0 #ff786b; 
16
}

Step 7: Sidebar Background!

You'll notice we've failed to define a background.. We'll apply the sidebar background, but not to the sidebar; we'll apply it to the body and repeat it on the y-axis so it runs from top to bottom. A position of left will also be used to ensure the background is placed on the left side of the page for the sidebar.

Seeing as this is a body style it may make sense to scroll up your CSS file and place it nearer the top. I also went ahead and added a font smoothening property for webkit browsers.

1
 
2
body { 
3
	background:#f8faf4 url(../images/sidebar_body.png) fixed left repeat-y; 
4
	-webkit-font-smoothing:antialiased; 
5
}

We'll have now completed the base of our sidebar!



Step 8: Navigation Time

Now the sidebar is made we can add the navigation to it. We'll create an unordered list and wrap it with the HTML5 Nav element.

1
 
2
<nav class="primary clearfix"> 
3
	<ul> 
4
		<li><a href="#">All</a></li> 
5
		<li><a href="#">Web Design</a></li> 
6
		<li><a href="#">Illustration</a></li> 
7
		<li><a href="#">Logo</a></li> 
8
		<li><a href="#">Video</a></li> 
9
		<li><a href="#">Print Design</a></li> 
10
	</ul> 
11
</nav>

Now some basic styling for the navigation, adding a background, font styles and also the font family from Google Web Fonts - PT Sans.

1
 
2
nav.primary ul li a { 
3
	background:url(../images/nav.png) repeat-x center top; 
4
	height:39px; 
5
	width:149px; 
6
	display:block; 
7
	border-bottom:1px solid #ba4b42; 
8
	font-family:'PT Sans Narrow', Helvetica, Arial, sans-serif; 
9
	font-size:18px; 
10
	color:#fff; 
11
	text-indent:20px; 
12
	text-shadow:0 -1px 0 #BA1E1A; 
13
	text-decoration:none; 
14
	line-height:39px; 
15
} 
16
nav.primary ul li a:hover { 
17
	color:#E9EBE5; 
18
	background-position:center bottom; 
19
}

Step 9: Creating the Main Content Area

1
 
2
<section class="main clearfix"> 
3
	 
4
	 
5
</section>

We'll now need to create a wrapping container which will hold the portfolio entries. Also, we'll have to add some margins and paddings to ensure the entries display in the correct place. This can be done by first moving the entire element away from the header and sidebar.

If we look at the header being 70px high we'll need 70px margin-top. The sidebar is 150px wide so we'll apply 150px margin-left. The final thing is 20px padding on the top and left to push the entries away from the header and sidebar.

1
 
2
.main { 
3
	padding:20px 20px 0; 
4
	margin:70px 0 0 150px; 
5
}

Step 10: Adding a Portfolio Entry

Time to start with the portfolio entries. Go ahead and create a div with a class of portfolio inside our main area, this will hold our portfolio items together. Our portfolio entry is made up of a figure (again an HTML5 element) which is used to denote a container for media of some sort.

We'll then have an image with two spans; one for the ribbon and one for the hover. You could also use pseudo-elements for these, which would lighten the markup, though reduce the browser compatibility of the page.

1
 
2
<section class="main clearfix"> 
3
	 
4
	<div class="portfolio"> 
5
		 
6
		<figure class="entry"> 
7
			<span class="ribbon"></span> 
8
			<img src="images/portfolio-image.jpg" alt=""> 
9
			<span class="hover"></span> 
10
		</figure> 
11
		 
12
	</div> 
13
 
14
</section>

Step 11: Styling the Portfolio Item

The styling for the portfolio is basic stuff. We'll float left and add 20px of margin right and bottom. To create the white border we'll simply add some padding and then a background, these will be rounded off using a simple border-radius of 5px (while remembering the prefixes). Finally, a box-shadow will be applied.

1
 
2
.entry { 
3
	position:relative; 
4
	float:left; 
5
	margin-right:20px; 
6
	margin-bottom:20px; 
7
	cursor:pointer; 
8
 
9
	background:#fff; 
10
	padding:10px; 
11
	width:440px; 
12
 
13
	-webkit-border-radius:5px; 
14
	-moz-border-radius:5px; 
15
	border-radius:5px; 
16
 
17
	-webkit-box-shadow:0 0 7px rgba(0,0,0,.1); 
18
	-moz-box-shadow:0 0 7px rgba(0,0,0,.1); 
19
	box-shadow:0 0 7px rgba(0,0,0,.1); 
20
}

As we're applying 20px of margin to the right of the entries we'll need to subtract that off the parent container (the portfolio div).

1
 
2
.portfolio { margin-right:-20px; }

Step 12: Adding the Entry Ribbon

We created the ribbon markup when adding the portfolio item (though, again, you may have used a pseudo-element), we'll now need to style it using CSS.

1
 
2
.ribbon { 
3
	background:url(../images/camera_ribbon.png) no-repeat; 
4
	width:31px; 
5
	height:47px; 
6
	position:absolute; 
7
	top:-4px; 
8
	right:11px; 
9
	z-index:9999; 
10
}

Step 13: Portfolio Hover State

The last thing to do for the portfolio is to add the hover state. This will be acheived with the span we created previously, all we need now is the styling. We'll use an image and a black background with an alpha opacity of 70%. We've also added some CSS3 transitions to allow a smooth hover effect. The last thing is to add opacity:1; for when hovering over the entry, which will fade in the hover part.

1
 
2
.hover { 
3
	background:rgba(0,0,0,.7) url(../images/hover.png) no-repeat center; 
4
	position:absolute; 
5
	top:10px; 
6
	left:10px; 
7
	bottom:13px; 
8
	right:10px; 
9
	opacity:0; 
10
	-webkit-transition:all .3s ease-in-out; 
11
	-moz-transition:all .3s ease-in-out; 
12
	-ms-transition:all .3s ease-in-out; 
13
	-o-transition:all .3s ease-in-out; 
14
	transition:all .3s ease-in-out; 
15
} 
16
 
17
.entry:hover .hover { opacity:1; }

Now our portfolio item is complete, you are free to add you own and change the images!



Step 14: Adaptive Goodness

Now that we have replicated the PSD into a working design, we'll go ahead and make it adaptive. We aren't using a purely flexible grid, which is why what we're practicing isn't technically responsive. We'll use CSS3 Media Queries to change and edit the layout when in different view modes. We'll use rough dimensions, giving us what can more-or-less be perceived as Tablet Portrait Orientation, Tablet Landscape Orientation, Mobile Portrait Orientation and, finally, Mobile Landscape Orientation.

Before we start editing the layout we need to do two things. Firstly we'll need to add the viewport meta tag which will allow our site to be viewed correctly on mobiles and tablets, if you'd like to find out more about this be sure to check out this article by Ian Yates. The last is to add a short bit of CSS to allow our images to be fluid:

1
 
2
img { 
3
	max-width:100%; 
4
}

Step 15: Tablet Portrait

We'll start off by targeting tablets with a portrait orientation. Only a small amount of editing is needed to be done to adjust our layout. The main one to take notice of is the entry; it will be made smaller to accommodate more entries on each line.

1
 
2
@media only screen and (min-width: 768px) and (max-width: 959px) { 
3
	.content { padding:20px 0 0 20px; } 
4
	.entry { width:258px; } 
5
}

Step 16: Tablet Landscape

Usually you wouldn't target the landscape orientation of a tablet unless you really have to, but because of the design of this page it will certainly help us out. We won't use min and max widths to determine the viewport size - we'll target it based on orientation. This time we're using even less code by simply changing the width of the portfolio entry.

1
 
2
@media only screen and (max-device-width: 1024px) and (orientation:landscape) {  
3
    .entry { width:386px; } 
4
}

Step 17: Mobile Portrait

We'll move onto mobiles now, starting with portrait orientation. This time we'll have to do a bit more editing. We're going to adjust the layout now, because of the screen getting smaller we're no longer able to accommodate the sidebar on the left with entries on the right. We'll move the sidebar up before the entries and have it fill the entire width of the screen.

Also, due to the header being a large size with the sidebar/navigation beneath it you may not be able to see as many of the entries. We'll remove the position: fixed and change it to absolute so the header will now scroll instead of staying at the top of the page.

1
 
2
@media only screen and (max-width: 767px) { 
3
	body { background-image:none; } 
4
 
5
	.header { 
6
		position:absolute; 
7
		float:left; 
8
		width:100%; 
9
	} 
10
 
11
	.logo { float:left; } 
12
	.hire-me { float:right; } 
13
 
14
	#wrapper { 
15
		float:left; 
16
		width:100%; 
17
	} 
18
 
19
	.sidebar { 
20
		width:100%; 
21
		position:relative; 
22
		z-index:1; 
23
		float:left; 
24
		border-right:1px solid #a13d36; 
25
		margin-right:-1px; 
26
		-webkit-box-shadow:none; 
27
		-moz-box-shadow:none; 
28
		box-shadow:none; 
29
	} 
30
 
31
	nav.primary li { 
32
		float:left; 
33
		width:100%; 
34
		background:url(../images/sidebar.png); 
35
	} 
36
 
37
	nav.primary ul li a {width:100%; } 
38
	 
39
	nav.primary ul li a:active, nav.primary ul li a.selected { background:url(../images/mobile_nav_active.png); } 
40
 
41
	.page { 
42
		float:left; 
43
		width:100%; 
44
	} 
45
 
46
	.main { 
47
		float:left; 
48
		padding:20px 20px 0; 
49
		margin:70px 0 0 0; 
50
	} 
51
 
52
	.entry { width:260px; } 
53
}

Step 18: Fixing Some Positioning Problems

Okay, now we've run into some problems. The sidebar has adjusted nicely to the screen layout, but portfolio entries are positioning incorrectly. We'll need to go back to our markup and add two extra divs, one with an id of wrapper which will wrap everything other than the header and another with a class of page which will wrap our main content area.

1
 
2
<div id="wrapper"> 
3
 
4
	<aside class="sidebar clearfix"> 
5
 
6
		<nav class="primary clearfix"> 
7
				<ul> 
8
					<li><a href="#" class="selected" data-filter="*">All</a></li> 
9
					<li><a href="#" data-filter=".web">Web Design</a></li> 
10
					<li><a href="#" data-filter=".ill">Ilustration</a></li> 
11
					<li><a href="#" data-filter=".logo">Logo</a></li> 
12
					<li><a href="#" data-filter=".video">Video</a></li> 
13
					<li><a href="#" data-filter=".print">Print Design</a></li> 
14
				</ul> 
15
			</nav> 
16
 
17
	</aside> 
18
 
19
	<div class="page"> 
20
 
21
		<section class="main clearfix"> 
22
			 
23
			<div class="portfolio"> 
24
				 
25
				<figure class="entry"> 
26
					<span class="ribbon"></span> 
27
					<img src="images/portfolio-image.jpg" alt=""> 
28
					<span class="hover"></span> 
29
				</figure> 
30
 
31
				<figure class="entry"> 
32
					<span class="ribbon"></span> 
33
					<img src="images/portfolio-image.jpg" alt=""> 
34
					<span class="hover"></span> 
35
				</figure> 
36
 
37
				<figure class="entry"> 
38
					<span class="ribbon"></span> 
39
					<img src="images/portfolio-image.jpg" alt=""> 
40
					<span class="hover"></span> 
41
				</figure> 
42
 
43
				<figure class="entry"> 
44
					<span class="ribbon"></span> 
45
					<img src="images/portfolio-image.jpg" alt=""> 
46
					<span class="hover"></span> 
47
				</figure> 
48
 
49
				<figure class="entry"> 
50
					<span class="ribbon"></span> 
51
					<img src="images/portfolio-image.jpg" alt=""> 
52
					<span class="hover"></span> 
53
				</figure> 
54
 
55
				<figure class="entry"> 
56
					<span class="ribbon"></span> 
57
					<img src="images/portfolio-image.jpg" alt=""> 
58
					<span class="hover"></span> 
59
				</figure> 
60
 
61
				<figure class="entry"> 
62
					<span class="ribbon"></span> 
63
					<img src="images/portfolio-image.jpg" alt=""> 
64
					<span class="hover"></span> 
65
				</figure> 
66
 
67
				<figure class="entry"> 
68
					<span class="ribbon"></span> 
69
					<img src="images/portfolio-image.jpg" alt=""> 
70
					<span class="hover"></span> 
71
				</figure> 
72
 
73
			</div> 
74
 
75
		</section> 
76
 
77
	</div> 
78
	<!-- page --> 
79
 
80
</div> 
81
<!-- wrapper -->

After adding in the necessary markup, we'll have to add some styles. Scroll back on up to the top of your CSS file and add the following:

1
 
2
#wrapper { 
3
    height:auto; 
4
    margin:0; 
5
    overflow:hidden; 
6
    padding:0; 
7
} 
8
 
9
.page { 
10
	position:relative; 
11
	overflow:hidden; 
12
	top:0px; 
13
	margin:0px; 
14
	padding:0px; 
15
	border-left:1px solid #a13d36; 
16
}

Step 19: Mobile Landscape

Okay, finally the landscape orientation for mobile. If you place this after the mobile portrait CSS we just created it'll inherit those styles, .e.g the full width sidebar etc. All we need to do now is change the entry width.

1
 
2
@media only screen and (min-width: 480px) and (max-width: 767px) { 
3
	.entry { width:190px; } 
4
}


Step 20: Introducing Isotope

Now we've covered creating the design we can start to give it some functionality! We'll be using the brilliant isotope plugin by David DeSandro. Isotope is used to create layouts, filtering and sorting. It is commonly used on portfolios to filter pieces of work into different categories - for example Web Design, Photography and Illustration. On that note, let's get it installed!

Before we can add it to our design we'll need to download it. Head on over to http://isotope.metafizzy.co/jquery.isotope.min.js. You'll now see the Isotope javascript file, just go to File > Save and save it in the js folder we created at the beginning. We'll need to then link to the script within your HTML file.

1
 
2
<script src="js/jquery.isotope.min.js"></script>

Step 21: The Filtering Process

To allow our portfolio items to be filtered we'll need to change our markup again. We'll start off with the navigation which will filter for us. Isotope uses HTML5 Custom Data Attributes, specifically data-filter="". We set a value depending on the category; Web Design uses .web (note that we have to add a period before the category value). The anchor tag for All categorys doesn't use .all though, it uses an asterisk.

1
 
2
<nav class="primary clearfix"> 
3
	<ul> 
4
		<li><a href="#" data-filter="*">All</a></li> 
5
		<li><a href="#" data-filter=".web">Web Design</a></li> 
6
		<li><a href="#" data-filter=".ill">Ilustration</a></li> 
7
		<li><a href="#" data-filter=".logo">Logo</a></li> 
8
		<li><a href="#" data-filter=".video">Video</a></li> 
9
		<li><a href="#" data-filter=".print">Print Design</a></li> 
10
	</ul> 
11
</nav>

Step 22: Filtering Portfolio Items

The final part of the filter process is to edit the portfolio items. After adding data-filter values you'll need to add the corresponding values to each entry. If the work entry is in the video category you'll need to add a class of video. Do note that if your data-filter values are lowercase, you must use lowercase for the entry classes.

1
 
2
<figure class="entry video"> 
3
	<span class="ribbon"></span> 
4
	<img src="images/portfolio-image.jpg" alt=""> 
5
	<span class="hover"></span> 
6
</figure>

Step 23: Hooking the Plugin

It's time to activate Isotope which we'll do in two parts. First we need to hook the part which will sort our portfolio entries. Start off by creating a new file called "custom.js" and place it in your js folder.

1
 
2
$(window).load(function(){ 
3
 
4
	var $container = $('.portfolio'); 
5
	$container.isotope({ 
6
		filter: '*', 
7
		animationOptions: { 
8
			duration: 750, 
9
			easing: 'linear', 
10
			queue: false, 
11
		} 
12
	}); 
13
 
14
});

Step 24: Click Function

The second part will hook the navigation to allow the filtering to happen.

1
 
2
$(window).load(function(){ 
3
 
4
	var $container = $('.portfolio'); 
5
	$container.isotope({ 
6
		filter: '*', 
7
		animationOptions: { 
8
			duration: 750, 
9
			easing: 'linear', 
10
			queue: false, 
11
		} 
12
	}); 
13
 
14
	$('nav.primary ul a').click(function(){ 
15
		var selector = $(this).attr('data-filter'); 
16
		$container.isotope({ 
17
			filter: selector, 
18
			animationOptions: { 
19
				duration: 750, 
20
				easing: 'linear', 
21
				queue: false, 
22
			} 
23
		}); 
24
	  return false; 
25
	}); 
26
 
27
});

Step 25: Adding an Active State

Shown in the PSD is an active state for the current selected navigation anchor. We'll need to add some more markup, some more CSS and finally some more jQuery. Start off by heading on back to your HTML file and adding class="selected" to the first anchor tag.

1
 
2
<nav class="primary clearfix"> 
3
	<ul> 
4
		<li><a href="#" class="selected" data-filter="*">All</a></li> 
5
		<li><a href="#" data-filter=".web">Web Design</a></li> 
6
		<li><a href="#" data-filter=".ill">Illustration</a></li> 
7
		<li><a href="#" data-filter=".logo">Logo</a></li> 
8
		<li><a href="#" data-filter=".video">Video</a></li> 
9
		<li><a href="#" data-filter=".print">Print Design</a></li> 
10
	</ul> 
11
</nav>

Next you'll need to add some more CSS, so add this just below the navigation styles.

1
 
2
nav.primary ul li a:active, nav.primary ul li a.selected { 
3
	background:url(../images/nav_active.png); 
4
	border-bottom:1px solid #9e3f38; 
5
}

The final part is some jQuery, this will add classes when clicked to show the active button/category.

1
 
2
var $optionSets = $('nav.primary ul'), 
3
       $optionLinks = $optionSets.find('a'); 
4
  
5
       $optionLinks.click(function(){ 
6
          var $this = $(this); 
7
	  // don't proceed if already selected 
8
	  if ( $this.hasClass('selected') ) { 
9
	      return false; 
10
	  } 
11
   var $optionSet = $this.parents('nav.primary ul'); 
12
   $optionSet.find('.selected').removeClass('selected'); 
13
   $this.addClass('selected');  
14
});

Step 26: Forgetting Something Are We?

If you go ahead and click the nav buttons you'll see that the filter is working! But wait, it's not a smooth transition! Well that's because we still have to add some CSS transitions.

1
 
2
.isotope-item { 
3
  z-index: 2; 
4
} 
5
 
6
.isotope-hidden.isotope-item { 
7
  pointer-events: none; 
8
  z-index: 1; 
9
} 
10
 
11
.isotope, 
12
.isotope .isotope-item { 
13
-webkit-transition-duration: 0.8s; 
14
   -moz-transition-duration: 0.8s; 
15
        transition-duration: 0.8s; 
16
} 
17
 
18
.isotope { 
19
-webkit-transition-property: height, width; 
20
   -moz-transition-property: height, width; 
21
        transition-property: height, width; 
22
} 
23
 
24
.isotope .isotope-item { 
25
-webkit-transition-property: -webkit-transform, opacity; 
26
   -moz-transition-property:    -moz-transform, opacity; 
27
        transition-property:         transform, opacity; 
28
}


Conclusion

And there we go, another useful tutorial complete! You're free to use this method in any designs you have. Go and have some fun with it.


I hope you enjoyed this tutorial, thanks for reading!

Advertisement
Did you find this post useful?
Want a weekly email summary?
Subscribe below and we’ll send you a weekly email summary of all new Web Design tutorials. Never miss out on learning about the next big thing.
Advertisement
Looking for something to help kick start your next project?
Envato Market has a range of items for sale to help get you started.