web/_javascript/modules/components/img-lazyload.js
2023-05-13 02:05:30 +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');
});
}