Mosaic Tiling with Lazy Image Loading Plugin

Mosaic Tiling Plugin is a simple JavaScript plugin that allows you to display images in a mosaic format. It has some extensibility, which can make adding lazy loading classes easy and simple.

What is mosaic tile?

Mosaic tiling is a simple feature that allows you to load images as much as possible in a given space.

js grid mosaic flat, masonry gallery with lightbox jquery, responsive masonry gallery, mosaic css grid, mosaic image gallery, how to make responsive grid in css

Options

There are several options the user can change, hoping to keep the plugin usable:

Container: The container is the global div identifier that the plugin uses to write all elements to it. This will be emptied by the plugin when the load function is called. Default value: masonryContainer

masonryColumn: This is the class applied to each “column” in the container. Default value: masonryColumn

masonryImgDiv: This is the class applied to every div containing an image. Mostly here for scalability, I personally used it for lazy loading. Default value: masonryImgDiv

masonryImg: This is the class applied to each image. Default value: masonryImg

Columns: This is an integer representing the number of columns to be generated by the plugin. I chose to simply include this here instead of hard coding in it so people can specify how many columns they want/need. This could very easily be expanded to include more breakpoints etc, but that was enough for my own purposes. Default value: 6

mobileColumns: This is an integer representing the number of columns that will appear when the width of the window is less than the segment number (defined next). Very simple, but can be expanded further in the add. Default value: 3

smallCutoff: This is an integer representing the width of the window where the screen will convert the number of columns to the mobileColumns value specified above. Default value: 800

imagesArray: As the name suggests, the array will contain all the image links. Default value: null

lazyLoading: This controls whether images entered into the plugin will appear by default. It will set the default src img to a simple spin if set to true and set the image itself if set to false. Default value: False

lazyLoadingClass: This is the class that will be applied to lazy-loaded images. When an image appears with the masonryImg tag and this tag as it is in its category, the image will be loaded. Default value: lazy

How to make use of it:

1. Import the stylesheet mosaic-styles.css and JavaScript lazy-load-mosaic-tile-script.js into the doc.

<link rel="stylesheet" href="mosaic-styles.css" />
<script src="lazy-load-mosaic-tile-script.js"></script>

2. Create a container aspect named masonryContainer.

<div id="masonryContainer">
</div>

3. Define an array of pictures to be showcased within the mosaic structure.

myImages = [
  "1.png", 
  "2.jpg",
  "3.webp",
  // ...
]

4. Create a brand new occasion for the mosaic structure.

var mosaic = new mosaicLayout({
    imagesArray: myImages
});

5. Initialize the mosaic layout and achieved it.

mosaic.initiate();

6. Override the default CSS class names.

var mosaic = new mosaicLayout({
    imagesArray: myImages,
    // container CSS
    container: "masonryContainer",
    // column CSS
    masonryColumn: "masonryColumn",
    // CSS class of image container
    masonryImgDiv: "masonryImgDiv",
    // CSS class of each image
    masonryImg: "masonryImg",
});

7. Determine what number of columns to indicate on desktop & mobile.

var mosaic = new mosaicLayout({
    imagesArray: myImages,
    columns: "6",
    mobileColumns: "3",
    smallCutoff: 800 // breakpoint
});

8. Enable picture lazy loading.

var mosaic = new mosaicLayout({
    imagesArray: myImages,
    lazyLoading: false,
    lazyLoadingClass: 'lazy',
});

Mosaic Tiling With Image Lazy Loading, Mosaic Tiling Plugin/Github, html mosaic gallery, masonry image gallery


See Demo And Download

Official Website(cspeloso): Click Here

This superior jQuery/javascript plugin is developed by cspeloso. For extra Advanced usage, please go to the official website.

Related Posts

VenoBox-Responsive-jQuery-Lightbox-Plugin

Responsive Image Gallery Lightbox jQuery Plugin | VenoBox

VenoBox is a responsive jQuery modal window plugin suitable for images, embedded content, iFrames, Google Maps, Vimeo, and YouTube videos. The big difference compared to many other…

bootstrap-dropdown-on-hover

[Animation] Bootstrap Multi-Level Responsive Dropdown Menu

Bootstrap-based multi-level dropdown navigation menu with cool animations. The dropdown on Hover is a jQuery plugin used to create Bootstrap multi-level scroll-triggered dropdown menus with CSS3 animations…

Google-Translate-Dropdown-Customize-With-Country-Flag

Google Translate Dropdown Customize With Country Flag | GT API

Flag google translates jQuery text that takes advantage of the Google Cloud Translation API to translate web content between languages by selecting a country from the dropdown…

Bootstrap-Fileinput

HTML 5 File Input Optimized for Bootstrap 4.x./3.x with File Preview | Bootstrap Fileinput

bootstrap-fileinput is an improved HTML 5 file input  Bootstrap 5.x, 4.x and 3.x with file preview for different files, provides multiple selections, resumable section uploads, and more….

HStack-and-VStack-in-CSS

CSS Layout Components Horizontal/Vertical Stack | HStack and VStack

HStack and VStack in CSS – CSS layout components that (basically) stack anything horizontally and vertically. A pure CSS library that makes it easy to stack elements…

Floating-Whatsapp-Chat-Button

How to Add Floating Whatsapp Chat Button In HTML | venom-button

Venom Button is a very simple plugin for the jQuery floating WhatsApp button. Adds a floating button to your site that calls WhatsApp Click to Chat API. It will automatically start the WhatsApp…

Leave a Reply

Your email address will not be published. Required fields are marked *