Lazy Javascript Loader for Images and Iframes | AyLazyLoader

AyLazyLoader is a lazy JavaScript loader plugin for lazy loading images and iframes based on IntersectionObserver. Automatically detects lazy items from Ajax orders. Supports srcset properties and sizes for images.

AyLazyLoader is a native lazy JavaScript loader for the slow loading of images, iframes, and AJAX content based on the Intersection Observer API.

How to make use of it:

Insert the script ay-lazy-loader.min.js into the HTML doc.

<script src="./dist/ay-lazy-loader.min.js"></script>

Initialize the AyLazyLoader and also you’re able to go.

var lazyLoader = new AyLazyLoader();

Add the class="lazy" attribute to photographs and iframes and outline the picture/iframe sources within the data-src attribute as follows:

<img class="lazy" data-src="">
<iframe class="lazy" style="width:100%;height:100%;" data-src="" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
<picture class="lazy">
  <source data-srcset="sun-320x320.jpg" media="(max-width: 320px)">
  <source data-srcset="sun-480x480.jpg" media="(min-width: 320.1px) and (max-width: 480px)">
  <source data-srcset="sun-720x720.jpg" media="(min-width: 480.1px) and (max-width: 720px)">
  <source data-srcset="sun-800x600.jpg" media="(min-width: 720.1px)">
  <img data-src="sun.jpg">

Determine whether or not to point out the photographs instantly after they loaded.

var lazyLoader = new AyLazyLoader({
    showImagesAfterLoaded: false

Determine whether or not to mechanically detect iframe content material.

var lazyLoader = new AyLazyLoader({
    autoDetectItemsFromAjaxRequests: false

Customize the CSS selector.

var lazyLoader = new AyLazyLoader({
    selectorClass: '.myClass'

Define the rootMargin offsets.

var lazyLoader = new AyLazyLoader({
    rootMargin: '200px 20px 200px 20px'

Lazy Loading Of Images And Iframes Using IntersectionObserver, AyLazyLoader Plugin/Github, lazy load background images, image loading attribute

See Demo And Download

Official Website(fatihkizmaz): Click Here

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

Related Posts


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…


[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…


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….


Interactive Data Table Generator with JS/jQuery and JSON | Tabulator

Tabulator allows you to create interactive tables in seconds from any HTML Table, JavaScript array, AJAX data source, or JSON format data. Just include the library in your…


Simple Alert, Confirm, Prompt Popup Using Vanilla JavaScript Library | attention.js

JavaScript provides various built-in functionality to display popup messages for different purposes. Attention JS is a vanillaJS plugin used to create a custom alert, confirm, or Prompt…


Lightweight Bootstrap 4 Toast Notification Plugin | BS4 Advanced Toast

A lightweight Bootstrap 4 Toast Notification plugin integrated with JS/jQuery. bs4-toast.js is a JavaScript library that enhances the native Bootstrap toast component with icons, buttons, callbacks, and…

Leave a Reply

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