feat: fade in lazy loaded images
This commit is contained in:
13
static/lazy.js
Normal file
13
static/lazy.js
Normal file
@ -0,0 +1,13 @@
|
||||
window.onload = function(){
|
||||
|
||||
var lazyImages = [...document.querySelectorAll("img[loading='lazy']")];
|
||||
|
||||
for (let i = 0; i < lazyImages.length; i++) {
|
||||
var element = lazyImages[i];
|
||||
element.classList.add("lazy-image")
|
||||
element.addEventListener("load", function(){
|
||||
element.classList.add("loaded");
|
||||
})
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user