Compare vanilla-lazyload features
mastervanilla-lazyload is a lightweight (2.8 kB) and flexible library that offers several performance-oriented features compared to other libraries like lazysizes.
Key advantages include:
- Optimized for INP: Uses
IntersectionObserver. - Download Cancellation: Cancels downloads of images that have already exited the viewport.
- Network Resilience: Retries loading images after a network connection is restored.
- Native Lazyloading Support: Can be configured to use native browser lazyloading via the
use_nativeoption. - Extended Media Support: Supports lazyloading animated SVGs (via
objecttag), videos (including multiple<source>tags), and background images (including HiDPI/Retina support). - Code Execution: Can lazily execute code when elements enter the viewport.
- DOM Restoration: Can restore the DOM to its original state using the
restoreAll()method.