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
|
||||
*/
|
||||
|
||||
function stopShimmer($node) {
|
||||
$node.parent().removeClass('shimmer');
|
||||
}
|
||||
|
||||
export function imgLazy() {
|
||||
if ($('#core-wrapper img[data-src]') <= 0) {
|
||||
const $images = $('#core-wrapper img[data-src]');
|
||||
|
||||
if ($images.length <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Stop shimmer when image loaded */
|
||||
document.addEventListener('lazyloaded', function (e) {
|
||||
const $img = $(e.target);
|
||||
$img.parent().removeClass('shimmer');
|
||||
stopShimmer($(e.target));
|
||||
});
|
||||
|
||||
/* Stop shimmer from cached images */
|
||||
$images.each(function () {
|
||||
if ($(this).hasClass('ls-is-cached')) {
|
||||
stopShimmer($(this));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue