fix: the cached image is covered by shimmer (#1100)
This commit is contained in:
parent
c075e11a4e
commit
df8ff546ec
1 changed files with 15 additions and 3 deletions
|
@ -2,14 +2,26 @@
|
||||||
* Set up image lazy-load
|
* Set up image lazy-load
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
function stopShimmer($node) {
|
||||||
|
$node.parent().removeClass('shimmer');
|
||||||
|
}
|
||||||
|
|
||||||
export function imgLazy() {
|
export function imgLazy() {
|
||||||
if ($('#core-wrapper img[data-src]') <= 0) {
|
const $images = $('#core-wrapper img[data-src]');
|
||||||
|
|
||||||
|
if ($images.length <= 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Stop shimmer when image loaded */
|
/* Stop shimmer when image loaded */
|
||||||
document.addEventListener('lazyloaded', function (e) {
|
document.addEventListener('lazyloaded', function (e) {
|
||||||
const $img = $(e.target);
|
stopShimmer($(e.target));
|
||||||
$img.parent().removeClass('shimmer');
|
});
|
||||||
|
|
||||||
|
/* Stop shimmer from cached images */
|
||||||
|
$images.each(function () {
|
||||||
|
if ($(this).hasClass('ls-is-cached')) {
|
||||||
|
stopShimmer($(this));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue