Gathering detailed insights and metrics for imagesloaded
Gathering detailed insights and metrics for imagesloaded
Gathering detailed insights and metrics for imagesloaded
Gathering detailed insights and metrics for imagesloaded
📷 JavaScript is all like "You images done yet or what?"
npm install imagesloaded
Typescript
Module System
Node Version
NPM Version
99.6
Supply Chain
100
Quality
75.8
Maintenance
100
Vulnerability
100
License
JavaScript (71.5%)
HTML (25.62%)
CSS (2.88%)
Love this project? Help keep it running — sponsor us today! 🚀
Total Downloads
64,551,769
Last Day
45,369
Last Week
229,349
Last Month
1,010,049
Last Year
12,607,467
MIT License
8,896 Stars
261 Commits
1,146 Forks
228 Watchers
2 Branches
20 Contributors
Updated on Feb 12, 2025
Minified
Minified + Gzipped
Latest Version
5.0.0
Package Id
imagesloaded@5.0.0
Unpacked Size
36.00 kB
Size
7.74 kB
File Count
6
NPM Version
8.4.0
Node Version
16.13.1
Cumulative downloads
Total Downloads
Last Day
1.2%
45,369
Compared to previous day
Last Week
1.3%
229,349
Compared to previous week
Last Month
27.5%
1,010,049
Compared to previous month
Last Year
2.3%
12,607,467
Compared to previous year
1
5
JavaScript is all like "You images done yet or what?"
Detect when images have been loaded.
1<script src="https://unpkg.com/imagesloaded@5/imagesloaded.pkgd.min.js"></script> 2<!-- or --> 3<script src="https://unpkg.com/imagesloaded@5/imagesloaded.pkgd.js"></script>
Install via npm: npm install imagesloaded
Install via Yarn: yarn add imagesloaded
You can use imagesLoaded as a jQuery Plugin.
1$('#container').imagesLoaded( function() { 2 // images have loaded 3}); 4 5// options 6$('#container').imagesLoaded( { 7 // options... 8 }, 9 function() { 10 // images have loaded 11 } 12);
.imagesLoaded()
returns a jQuery Deferred object. This allows you to use .always()
, .done()
, .fail()
and .progress()
.
1$('#container').imagesLoaded() 2 .always( function( instance ) { 3 console.log('all images loaded'); 4 }) 5 .done( function( instance ) { 6 console.log('all images successfully loaded'); 7 }) 8 .fail( function() { 9 console.log('all images loaded, at least one is broken'); 10 }) 11 .progress( function( instance, image ) { 12 var result = image.isLoaded ? 'loaded' : 'broken'; 13 console.log( 'image is ' + result + ' for ' + image.img.src ); 14 });
You can use imagesLoaded with vanilla JS.
1imagesLoaded( elem, callback )
2// options
3imagesLoaded( elem, options, callback )
4// you can use `new` if you like
5new imagesLoaded( elem, callback )
elem
Element, NodeList, Array, or Selector Stringoptions
Objectcallback
Function - function triggered after all images have been loadedUsing a callback function is the same as binding it to the always
event (see below).
1// element 2imagesLoaded( document.querySelector('#container'), function( instance ) { 3 console.log('all images are loaded'); 4}); 5// selector string 6imagesLoaded( '#container', function() {...}); 7// multiple elements 8var posts = document.querySelectorAll('.post'); 9imagesLoaded( posts, function() {...});
Bind events with vanilla JS with .on(), .off(), and .once() methods.
1var imgLoad = imagesLoaded( elem ); 2function onAlways( instance ) { 3 console.log('all images are loaded'); 4} 5// bind with .on() 6imgLoad.on( 'always', onAlways ); 7// unbind with .off() 8imgLoad.off( 'always', onAlways );
Detect when background images have loaded, in addition to <img>
s.
Set { background: true }
to detect when the element's background image has loaded.
1// jQuery 2$('#container').imagesLoaded( { background: true }, function() { 3 console.log('#container background image loaded'); 4}); 5 6// vanilla JS 7imagesLoaded( '#container', { background: true }, function() { 8 console.log('#container background image loaded'); 9});
See jQuery demo or vanilla JS demo on CodePen.
Set to a selector string like { background: '.item' }
to detect when the background images of child elements have loaded.
1// jQuery 2$('#container').imagesLoaded( { background: '.item' }, function() { 3 console.log('all .item background images loaded'); 4}); 5 6// vanilla JS 7imagesLoaded( '#container', { background: '.item' }, function() { 8 console.log('all .item background images loaded'); 9});
See jQuery demo or vanilla JS demo on CodePen.
1// jQuery 2$('#container').imagesLoaded().always( function( instance ) { 3 console.log('ALWAYS - all images have been loaded'); 4}); 5 6// vanilla JS 7imgLoad.on( 'always', function( instance ) { 8 console.log('ALWAYS - all images have been loaded'); 9});
Triggered after all images have been either loaded or confirmed broken.
instance
imagesLoaded - the imagesLoaded instance1// jQuery 2$('#container').imagesLoaded().done( function( instance ) { 3 console.log('DONE - all images have been successfully loaded'); 4}); 5 6// vanilla JS 7imgLoad.on( 'done', function( instance ) { 8 console.log('DONE - all images have been successfully loaded'); 9});
Triggered after all images have successfully loaded without any broken images.
1$('#container').imagesLoaded().fail( function( instance ) { 2 console.log('FAIL - all images loaded, at least one is broken'); 3}); 4 5// vanilla JS 6imgLoad.on( 'fail', function( instance ) { 7 console.log('FAIL - all images loaded, at least one is broken'); 8});
Triggered after all images have been loaded with at least one broken image.
1imgLoad.on( 'progress', function( instance, image ) { 2 var result = image.isLoaded ? 'loaded' : 'broken'; 3 console.log( 'image is ' + result + ' for ' + image.img.src ); 4});
Triggered after each image has been loaded.
instance
imagesLoaded - the imagesLoaded instanceimage
LoadingImage - the LoadingImage instance of the loaded imageImage - The img
element
Boolean - true
when the image has successfully loaded
Array of LoadingImage instances for each image detected
1var imgLoad = imagesLoaded('#container'); 2imgLoad.on( 'always', function() { 3 console.log( imgLoad.images.length + ' images loaded' ); 4 // detect which image is broken 5 for ( var i = 0, len = imgLoad.images.length; i < len; i++ ) { 6 var image = imgLoad.images[i]; 7 var result = image.isLoaded ? 'loaded' : 'broken'; 8 console.log( 'image is ' + result + ' for ' + image.img.src ); 9 } 10});
Install imagesLoaded with npm.
1npm install imagesloaded
You can then require('imagesloaded')
.
1// main.js 2var imagesLoaded = require('imagesloaded'); 3 4imagesLoaded( '#container', function() { 5 // images have loaded 6});
Use .makeJQueryPlugin
to make .imagesLoaded()
jQuery plugin.
1// main.js 2var imagesLoaded = require('imagesloaded'); 3var $ = require('jquery'); 4 5// provide jQuery argument 6imagesLoaded.makeJQueryPlugin( $ ); 7// now use .imagesLoaded() jQuery plugin 8$('#container').imagesLoaded( function() {...});
Run webpack.
1webpack main.js bundle.js
imagesLoaded works with Browserify.
1npm install imagesloaded --save
1var imagesLoaded = require('imagesloaded'); 2 3imagesLoaded( elem, function() {...} );
Use .makeJQueryPlugin
to make to use .imagesLoaded()
jQuery plugin.
1var $ = require('jquery'); 2var imagesLoaded = require('imagesloaded'); 3 4// provide jQuery argument 5imagesLoaded.makeJQueryPlugin( $ ); 6// now use .imagesLoaded() jQuery plugin 7$('#container').imagesLoaded( function() {...});
Use imagesLoaded v4 for Internet Explorer and other older browser support.
Development uses Node.js v16 with npm v8
1nvm use
imagesLoaded is released under the MIT License. Have at it.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
5 existing vulnerabilities detected
Details
Reason
Found 3/28 approved changesets -- score normalized to 1
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-02-10
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More@types/imagesloaded
TypeScript definitions for imagesloaded
flickity-imagesloaded
Enable imagesLoaded option for Flickity
@cc-external/imagesloaded
Install package "imagesloaded" with externals configuration for "cc-webpack-externals-plugin"
react-images-loaded
React bindings for the imagesloaded library