Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                
<section id="portfolio">
	<center>
	<h1>Jquery portfolio filter.</h1>
</center>
	<ul id="menu">
		<li><a data-target="all" class="active" href="#">All</a></li>
		<li><a data-target="html" href="#">HTML</a></li>
		<li><a data-target="css" href="#">CSS</a></li>
		<li><a data-target="javascript" href="#">Javascript</a></li>
		<li><a data-target="php" href="#">PHP</a></li>
		<li><a target="_blank" href="https://insidethediv.com/jquery-portfolio-filter">More</a></li>
	</ul>
	
	<div id="items">
		<div class="single-item html">
			<img src="https://via.placeholder.com/245x200.png?text=HTML" alt="HTML Item">
		</div>
		<div class="single-item javascript">
			<img src="https://via.placeholder.com/245x200.png?text=JS" alt="JS Item">
		</div>
		<div class="single-item css">
			<img src="https://via.placeholder.com/245x200.png?text=CSS" alt="CSS Item">
		</div>
		<div class="single-item html">
			<img src="https://via.placeholder.com/245x200.png?text=HTML" alt="HTML Item">
		</div>
		<div class="single-item css">
			<img src="https://via.placeholder.com/245x200.png?text=CSS" alt="CSS Item">
		</div>
		<div class="single-item javascript">
			<img src="https://via.placeholder.com/245x200.png?text=JS" alt="JS Item">
		</div>
		<div class="single-item php">
			<img src="https://via.placeholder.com/245x200.png?text=PHP" alt="PHP Item">
		</div>
		<div class="single-item html">
			<img src="https://via.placeholder.com/245x200.png?text=HTML" alt="HTML Item">
		</div>
		
			<div class="single-item css">
			<img src="https://via.placeholder.com/245x200.png?text=CSS" alt="CSS Item">
		</div>
		<div class="single-item html">
			<img src="https://via.placeholder.com/245x200.png?text=HTML" alt="HTML Item">
		</div>
		<div class="single-item php">
			<img src="https://via.placeholder.com/245x200.png?text=PHP" alt="PHP Item">
		</div>
		<div class="single-item javascript">
			<img src="https://via.placeholder.com/245x200.png?text=JS" alt="JS Item">
		</div>
	</div>
	
	

</section>
<br>
<iframe id="video_show" class="my-2" width="100%" height="400" title="How to create jQuery portfolio filter gallery" src="https://www.youtube.com/embed/IesZkP13zdE">
     </iframe>
              
            
!

CSS

              
                #portfolio{
	width:1000px;
	margin:0px auto;
}
#portfolio #menu{
	text-align:center;
	margin:0px;
	padding:0px;
	list-style:none;
}

#portfolio #menu li{
	display: inline-block;
}
#portfolio #menu li a{
	display: inline-block;
	padding:4px 20px;
	border: 1px solid #333;
	text-decoration:none;
}
#portfolio #menu li .active{
	background:green;
	color:#fff;
}

#items {
	text-align:center;
	margin-top:40px;
}
#items .single-item{
	display:inline-block;
	margin-top:2px;
}
              
            
!

JS

              
                // use jquery cdn


$(document).ready(function(){
	
	$("#menu li a").click(function(){
		
		// add and remove active class on menu button
			$("#menu li a").removeClass('active');
		  $(this).addClass('active');
		// end
		
		var targeted_item = $(this).data('target');
		
		if(targeted_item === "all"){
			$(".single-item").fadeIn(); // show all
		}else{
			$(".single-item").hide(); // hide all
		  $("."+targeted_item).fadeIn(); // show clicked item
		}
		
		
		
	})
	
	
	
	
})
              
            
!
999px

Console