We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c075e11 commit df8ff54Copy full SHA for df8ff54
_javascript/modules/components/img-lazyload.js
@@ -2,14 +2,26 @@
2
* Set up image lazy-load
3
*/
4
5
+function stopShimmer($node) {
6
+ $node.parent().removeClass('shimmer');
7
+}
8
+
9
export function imgLazy() {
- if ($('#core-wrapper img[data-src]') <= 0) {
10
+ const $images = $('#core-wrapper img[data-src]');
11
12
+ if ($images.length <= 0) {
13
return;
14
}
15
16
/* Stop shimmer when image loaded */
17
document.addEventListener('lazyloaded', function (e) {
- const $img = $(e.target);
- $img.parent().removeClass('shimmer');
18
+ stopShimmer($(e.target));
19
+ });
20
21
+ /* Stop shimmer from cached images */
22
+ $images.each(function () {
23
+ if ($(this).hasClass('ls-is-cached')) {
24
+ stopShimmer($(this));
25
+ }
26
});
27
0 commit comments