How to detect background images only?
jinyus opened this issue · comments
jinyus commented
David DeSandro commented
Sorry, there is no API to only check for background images. But you can monkey-patch a solution. Add this code:
ImagesLoaded.prototype.addElementImages = function( elem ) {
// get background image on element
if ( this.options.background === true ) {
this.addElementBackgroundImages( elem );
}
// get child background images
if ( typeof this.options.background == 'string' ) {
var children = elem.querySelectorAll( this.options.background );
for ( i=0; i < children.length; i++ ) {
var child = children[i];
this.addElementBackgroundImages( child );
}
}
};