1
0
mirror of https://github.com/cotes2020/jekyll-theme-chirpy.git synced 2025-12-19 14:14:17 +00:00

chore(deps): use lazysizes to load images

This commit is contained in:
Cotes Chung
2022-12-09 07:03:13 +08:00
parent 7651d2851b
commit ca41c7ebff
10 changed files with 26 additions and 32 deletions

View File

@@ -1,6 +1,5 @@
/**
Lazy load images (https://github.com/ApoorvSaxena/lozad.js)
and popup when clicked (https://github.com/dimsemenov/Magnific-Popup)
Set up image popup stuff (https://github.com/dimsemenov/Magnific-Popup)
*/
$(function () {
@@ -10,12 +9,6 @@ $(function () {
return;
}
/* lazy loading */
const imgList = document.querySelectorAll(`${IMG_SCOPE} img[data-src]`);
const observer = lozad(imgList);
observer.observe();
/* popup */
$(`${IMG_SCOPE} p > img[data-src], ${IMG_SCOPE} img[data-src].preview-img`).each(