From 9e200ac56d285b8e9672da8312af6202c65bab9a Mon Sep 17 00:00:00 2001 From: Ivan Atanasov <30825404+iatanasov-frt@users.noreply.github.com> Date: Thu, 3 Jan 2019 17:55:29 +0200 Subject: [PATCH] Take into account the hidden elements --- lib/appear.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/appear.js b/lib/appear.js index e96d197..d86acff 100644 --- a/lib/appear.js +++ b/lib/appear.js @@ -23,6 +23,7 @@ function viewable(el, bounds){ var rect = el.getBoundingClientRect(); return ( + !(rect.top === 0 && rect.bottom === 0 && rect.height === 0) && (rect.top + rect.height) >= 0 && (rect.left + rect.width) >= 0 && (rect.bottom - rect.height) <= ( (window.innerHeight || document.documentElement.clientHeight) + bounds) &&