Cutwell / lazy-image-loader

Lazy image loading for graphic-heavy websites on low-bandwidth connections

Home Page:https://cutwell.github.io/lazy-image-loader/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

image comparison

Requirements

• lazy images must all use a consistent height and width as their original image to ensure correct page layout is maintained (this can be achieved with smaller images enlarged via css).

Usage

View an example page at example.html

Construct your HTML page as below. Once imported, the JS script runs automatically and will lazy load images once any part of the image enters the viewport.

<!-- low rez placeholder image loaded early, hi-rez image loaded late once in viewport -->
<img name="lazy" lazy-src="assets/hi_forest.png" src="assets/lz_forest.png" \>

<!-- load lazy load script at end of file -->
<script src="lazy/lazy.min.js"></script>

Testing

View how the page performs using your browers Developer Tools, try throttling your page load if your internet is too fast.

Attribution

  • Example lazy load image: Photo by Luis del Río from Pexels

About

Lazy image loading for graphic-heavy websites on low-bandwidth connections

https://cutwell.github.io/lazy-image-loader/


Languages

Language:JavaScript 60.4%Language:HTML 39.6%