Skip to content

Commit

Permalink
improvement(export): export function to processed DOM loaded after DO…
Browse files Browse the repository at this point in the history
…M ready
  • Loading branch information
PikachuEXE committed Apr 17, 2020
1 parent a21b7d5 commit fce352f
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions loading-attribute-polyfill.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* Use an IntersectionObserver polyfill in case of IE11 support necessary.
*/

(function (noscriptClass, rootMargin) {
const lazyload = function (noscriptClass = 'loading-lazy', rootMargin = '256px 0px') {
'use strict';

var config = {
Expand Down Expand Up @@ -236,7 +236,9 @@
*/
function prepareElements() {
//
var lazyLoadAreas = document.querySelectorAll('noscript.' + noscriptClass);
var lazyLoadAreas = document.querySelectorAll(
'noscript.' + config.noscriptClass
);

lazyLoadAreas.forEach(prepareElement);

Expand All @@ -260,4 +262,8 @@
}
});
}
})('loading-lazy', '256px 0px');
};

lazyload();

export default lazyload;

0 comments on commit fce352f

Please sign in to comment.