diff --git a/README.md b/README.md index 89b3ce6..165d2f5 100644 --- a/README.md +++ b/README.md @@ -146,6 +146,7 @@ Use these attributes on your HTML element like this: | data-initinview | boolean: true | Set this to true if you want the resource to execute (for example video to play) when the element is in view. ## Changelog +* v2.0 use IntersectionObserver instead of scroll listener, for better performance. * v1.1.901 betterify example page * v1.1.9 remove gulp and rollup and use webpack instead * use Babel 7 diff --git a/src/lazyframe.js b/src/lazyframe.js index d8418da..f79495a 100644 --- a/src/lazyframe.js +++ b/src/lazyframe.js @@ -100,7 +100,7 @@ const Lazyframe = () => { function loop(el) { - if (el instanceof HTMLElement === false || + if (!(el instanceof HTMLElement) || el.classList.contains('lazyframe--loaded')) return; const lazyframe = {