Javatpoint Logo
Javatpoint Logo

Lazy load images using jQuery

In this article, we will create lazy load images with the help of jQuery. In the beginning of this article, we will learn the basics of jQuery. After that we will learn the basics of lazy load images.

What is jQuery?

JQuery is a fast, lightweight, small, and feature-rich JavaScript library. For adding jQuery in the HTML page we can use the <script> tag.

In this, the src attribute is where we can add the source of jQuery.

You can also download the jQuery and add the source of jQuery in the src attribute of the <script> tag.

What do you mean by lazy load images in jQuery?

In jQuery, Lazy Load Images is a set of techniques in web and application that delaying the loading of images on a page to a later point in time - when those images are actually needed. With the use of this functionality, we can reduce the initial loading time of a web page.

Let's take the various examples of lazy load images using jQuery.

Example 1:

Explanation:

In the above example we created an example of lazy load for this we used the loading attribute set to lazy.

lazy-load-images-using-jquery

Output:

Below is the output of this example.

Lazy load images using jQuery

Example 2:

Explanation:

In the above example we have created an example of lazy load for this we used the loading attribute set to lazy.

Output:

Below is the output of this example.

Lazy load images using jQuery

Example 3:

Explanation:

In the above example we have created an example of lazy load for this we have used the class = "lazy-load".

Output:

Below is the output of this example.

Lazy load images using jQuery
Next Topic#





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA