Responsive Filter Gallery with jQuery and CSS3

Responsive Filter Gallery with jQuery and CSS3
Code Snippet:Filtered Image Gallery
Author: Stanislav Andreev
Published: January 19, 2024
Last Updated: January 22, 2024
Downloads: 9,622
License: MIT
Edit Code online: View on CodePen
Read More

Yet another lightweight and responsive filter gallery with jQuery and CSS3. The plugin, “Filtered Image Gallery” provides a responsive grid layout for images and generates image filtering tags dynamically.
This simple gallery plugin is best to show portfolios and product items with an image filter. You can fully customize it with CSS according to your needs.

How to Build Responsive Filter Gallery

1. Load the jQuery and Filtered Image Gallery‘s CSS and JavaScript file into your webpage to create a responsive filter gallery.

<!-- jQuery -->
<script src=""></script>

<!-- Filter Gallery CSS -->
<link rel="stylesheet" href="css/style.css" />

<!-- Filter Gallery Js -->
<script src="js/filter-tags.js"></script>

2. Create div element with attribute id="buttons" in which filter buttons/tags will be generated dynamically.

<div id="buttons"></div>

3. After that, create another div with attribute id="gallery" and place your image in it.

 <div id="gallery">
      <img src="img/01.jpg" data-tags="Animators, Illustrators" alt="lemon" />
      <img src="img/02.jpg" data-tags="Photographers, Filmmakers" alt="car" />
      <img src="img/03.jpg" data-tags="Photographers, Filmmakers" alt="animals" />
      <img src="img/04.jpg" data-tags="Designers" alt="sites" />
      <img src="img/05.jpg" data-tags="Photographers, Filmmakers" alt="team music" /> 
      <img src="img/06.jpg" data-tags="Designers, Illustrators" alt="flowers" />
      <img src="img/07.jpg" data-tags="Photographers" alt="nature" />
      <img src="img/08.jpg" data-tags="Designers" alt="laguna" />   
      <img src="img/09.jpg" data-tags="Animators, Illustrators" alt="design" />

Tip: Pass data-tags attribute to each image to sort the image. You can use multiple values. i.e data-tags="Photographers, Filmmakers"

4. The basic CSS styles for gallery layout.

	text-align: center;
	margin: 20px 0;}

button {
	background-color: #f2f2f2;
	border: 1px solid #ccc;
	padding: 3px 10px 4px 10px;
	margin: 0 1px;
	border-radius: 4px;
	color: #333;
	font-family: 'Karla', sans-serif;
	font-size: 100%;}

button:hover, {
	background-color: #b48450;
	color: #fff;
	cursor: pointer;}

#gallery {
	text-align: center;
	max-width: 1020px;
	margin: 0 auto;}

#gallery img {
	width: 300px;
	height: 150px;
	border-radius: 3px;
	border: 8px solid #fff;
	margin: 6px;
    -webkit-box-shadow: 0 0 3px 3px #ebebeb;
    box-shadow: 0 0 3px 3px #ebebeb;
	float: left;}

That’s all! hopefully, you have successfully created a responsive filter gallery. If you have any questions or suggestions, feel free to comment below.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

About CodeHim

Free Web Design Code & Scripts - CodeHim is one of the BEST developer websites that provide web designers and developers with a simple way to preview and download a variety of free code & scripts. All codes published on CodeHim are open source, distributed under OSD-compliant license which grants all the rights to use, study, change and share the software in modified and unmodified form. Before publishing, we test and review each code snippet to avoid errors, but we cannot warrant the full correctness of all content. All trademarks, trade names, logos, and icons are the property of their respective owners... find out more...

Please Rel0ad/PressF5 this page if you can't click the download/preview link