Add lazy image loading to an existing jQuery website to reduce how long it takes for the page to first appear
Reduce server image requests on long pages where many visitors never scroll to the bottom
Integrate lazy loading into a legacy jQuery project without switching to a modern framework
Requires jQuery already on the page, this is a legacy plugin, the author now recommends a vanilla JS version for new projects.
Lazyload is a jQuery plugin that delays the loading of images on a web page until the user actually scrolls down to see them. Normally, a browser tries to load every image on a page as soon as it opens, even images far below the fold that the visitor may never reach. This plugin changes that behavior so only images visible in the current viewport are loaded right away, and the rest wait. The benefit is a faster initial page load. When a page contains many large images, loading them all upfront can slow things down considerably. With this plugin, the browser reaches its ready state sooner because it only fetches the images currently on screen. As a side effect, this can also reduce the number of requests hitting the server if visitors leave before scrolling all the way down. Setup requires jQuery already present on the page. You add the plugin script, then change your image tags slightly: instead of a normal src attribute pointing to the image file, you put that URL in a data-original attribute and give the image a class like lazy. A single line of JavaScript then activates the plugin on those images. That is the entire integration. Installation can be done via Bower or npm, two common JavaScript package managers, making it easy to pull the plugin into an existing project without manually downloading files. The project is marked as a legacy plugin, originally built around an older version of jQuery, and the author now recommends a separate vanilla JavaScript version for new projects. The code is released under the MIT License, which places very few restrictions on how you can use or modify it.
← tuupola on gitmyhub — every repo by this author, as a profile.
Verify against the repo before relying on details.