vanilla-lazyload
Advanced tools
Changelog
17.1.0
loadAll()
call. It's better for performance, and it solves #469.load_all.html
demoChangelog
17.0.0
elements_selector
option now defaults to .lazy
(was img
)cancel_on_exit
option now defaults to true
(was false
)See UPGRADE.md to understand if you are impacted by any breaking change and how to upgrade from previous versions.
Love this project? 😍 Buy me a coffee!
Changelog
16.1.0
Improved speed, cleaning DOM, better working destroy, and also fixed 2 bugs.
data
attributes from the DOM when finished using them (mainly when elements have finished loading)destroy
method, which now also removes lazyload's additions to the DOM elementsloadeddata
event, no longer to load
_poster_ is undefined
was thrownloading
class was added without knowing whether or not the loading had startedChangelog
16.0.0
Functional changes:
callback_reveal
load()
method in favor of the static LazyLoad.load()
methodauto_unobserve
with unobserve_completed
, still defaulting to true
unobserve_entered
option (useful to execute lazy functions once)lazy_functions.html
to show how to execute functions as elements enter the viewportresetElementStatus()
to the static LazyLoad.resetStatus()
load_delay
option since there's no more use for itload_delay
related demosSee UPGRADE.md to understand if you are impacted by any breaking change and how to upgrade from previous versions.
Internal changes:
cancel_on_exit
with less increase/decrease of the toLoadCount
propertylazyload.counters
fileLove this project? 😍 Buy me a coffee!
Changelog
15.2.0
OPTIMIZE FOR SLOW CONNECTIONS WITH cancel_on_exit
Want to optimize speed for users who scroll down fast on a slow connection? Just set cancel_on_exit: true
and LazyLoad will cancel the download of images exiting the viewport while still loading, eventually restoring the original attributes.
cancel_on_exit
option.callback_cancel
option, just in case you want to perform any additional action whenever a download gets canceled by cancel_on_exit
.cancel_on_exit.html
so you can try the new cancel_on_exit
option live.cancel_on_exit
to true
in the following demos, so you can test how it behaves...
image_ph_inline.html
, with an inline SVG placeholderimage_ph_external.html
, with an external SVG placeholderdelay_test.html
, in conjuction with the delay_load
optionfade_in.html
, with a beautiful fade-in effect.The cancel_on_exit
option applies only to images so to the img
(and picture
) tags. It doesn't work for background images, iframe
s nor video
s.
The cancel_on_exit
option will probably default to true
starting from the next major version, so give it a try! And please report your feedback in the comments of #438.
API
resetElementStatus()
method for when you need to tell LazyLoad to consider an image (or other DOM element) again. This is particularly useful if you change the data-src
attribute after the previous data-src
was loaded). See the API section in the README file for more information.FIX
callback_exit
callback was called several times (for every images out of the viewport) at instance creation or upon update()
calls. Now the callback is properly called only when any element exits the viewport.INTERNALS
data-ll-status
attribute can take. Removed the status "observed"
(it was useless) and introduced status "delayed"
.Changelog
15.1.1
Fixed a bug when loading lazy background images on HiDPI screens, data-bg-hidpi
was mandatory, not it fallbacks to data-bg
. #430
Changelog
15.1.0
Lazy background images just gained support for hiDPI ("retina") screens!
Place your standard resolution images in the data-bg
attribute and your hiDPI images in data-bg-hidpi
.
Same for data-bg-multi
and data-bg-multi-hidpi
.
Changelog
15.0.0
Lazy background images gained loaded/error classes and callbacks! 🎉
Breaking changes impacting lazy background images! ⚠ See UPGRADE.md to understand if you are impacted and how to upgrade from previous versions.
data-bg
attribute, now manages the load
and error
events, so they are applied the classes defined in the class_loading
/class_loaded
/class_error
, and the callbacks defined in callback_loading
/callback_loaded
/callback_error
.data-bg-multi
attribute. In this case, the load
and error
events are not managed. The class_applied
and callback_applied
can be used to understand when the multiple background was applied to the element.Love this project? 😍 Buy me a coffee!