jQuery Portfolio Gallery with Categories Filter

jQuery Portfolio Gallery with Categories Filter
Code Snippet:Mau Gallery
Author: Eleftherios Psitopoulos
Published: January 19, 2024
Last Updated: January 22, 2024
Downloads: 9,165
License: MIT
Edit Code online: View on CodePen
Read More

A lightweight, cross-browser, and mobile-friendly plugin for jQuery to create a portfolio gallery with a categories filter. The Mau Gallery is mainly built with Bootstrap 4 and jQuery. It auto-generates tags/categories to the top or bottom of the images grid. Users can filter images through these categories.

How to Create Portfolio Gallery

1. Load the Bootstrap framework on your web page just after the jQuery to get started with Mau Gallery.

<!-- jQuery -->
<script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>

<!-- Bootstrap CSS -->
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">

<!-- Bootstrap JS -->
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>

<!-- Popper Js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.15.0/popper.min.js"></script>

2. After that, include Mau Gallery‘s JavaScript file into your page.

<!-- Mau Gallery Js -->
<script src="assets/mauGallery.min.js"></script>

3. Create a markup for the portfolio gallery and add your image links in. Add data-gallery-tag attributes for grouping your images in categories. These tags will be used to filter categories.

<div class="gallery" style="display:none;">
   <img data-gallery-tag="women" class="gallery-item" src="path/to/your-image.jpg">
   <img data-gallery-tag="men" class="gallery-item" src="path/to/your-image.jpg">
   <img data-gallery-tag="coffee" class="gallery-item" src="path/to/your-image.jpg">
   <img data-gallery-tag="men" class="gallery-item" src="path/to/your-image.jpg">
   <img data-gallery-tag="dogs" class="gallery-item" src="path/to/your-image.jpg">

4. Initialize the plugin in the jQuery document ready function with all default settings.

$(document).ready(function() {



Options for jQuery Portfolio Gallery with Categories

The following are some advanced configuration options to create a “portfolio gallery”.

Option Description, Default, Type
columns Define the columns for the portfolio gallery. Default: 3, Type: Number.

   columns: 4,
lightbox Decide whether to show images in Bootstrap modal / lightbox on click. Default: true, Type: Boolean.

   lightBox: true,
lightboxId Define the unique id for lightbox. Default: null, Type: String.
Pass the id in string.

   lightboxId: 'myAwesomeLightbox',
showTags Enable/disable the category-based filter. Default: true, Type: Boolean.

    showTags: true,
tagsPosition Define the position for tags/categories where should they appear. Default: “bottom”, Type: String.
Available options are: ‘bottom’ | ‘top’

   tagsPosition: 'bottom'

That’s all! hopefully, you have successfully created a portfolio gallery with categories. 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