web/_javascript/modules/components/img-lazyload.js
2023-06-26 21:54:20 +08:00

15 lines
303 B
JavaScript

/**
* Set up image lazy-load
*/
export function imgLazy() {
if ($('#core-wrapper img[data-src]') <= 0) {
return;
}
/* Stop shimmer when image loaded */
document.addEventListener('lazyloaded', function (e) {
const $img = $(e.target);
$img.parent().removeClass('shimmer');
});
}