Skip to content

Latest commit

 

History

7 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ImgLazyLoadingJavascript

A pure javascript way to lazy load images without a server can be run by just dropping example html file into browser.

Works by getting the image tags which have a data-src tag instead of a src tag on them, then detecting the boundaries hit the scroll position + window.innerHeight and setting src on the image causing the iamges to be loaded.

This requires javascript if javaascript is disabled then the lazyloading images won't load.



example:

a gif of html page scrolling down

Image credits:

Horse: https://www.freeimages.com/photo/horse-1393073

Butterfly: https://www.freeimages.com/photo/butterfly-1392408

Goat: https://www.freeimages.com/photo/my-beloved-mountains-2-1375135

Rope Knot: https://www.freeimages.com/photo/hunter-s-bend-1316926

About

A pure javascript way to lazy load images without a server.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages