Skip to content

Commit

Permalink
moving loader
Browse files Browse the repository at this point in the history
  • Loading branch information
ibrahimab committed Aug 11, 2020
1 parent bece4c6 commit b5b2716
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions js/flat-lazy.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions src/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ module.exports = function loader(entries, observer) {

if (entry.isIntersecting === true && target.getAttribute('data-loaded') == '0') {

// loading image
target.src = target.getAttribute('data-src');

// marking it as loaded
target.setAttribute('data-loaded', '1');

Expand All @@ -16,9 +19,6 @@ module.exports = function loader(entries, observer) {
if (target.getAttribute('data-flat-lazy-load-intersected') == '1') {
target.dispatchEvent(new CustomEvent('flat.lazyload.intersected', {bubbles: true}));
}

// and finally loading image
target.src = target.getAttribute('data-src');
}
});
};

0 comments on commit b5b2716

Please sign in to comment.