From 5c79478a577aa1046cee65ad4a419a505d5f7c47 Mon Sep 17 00:00:00 2001 From: Frank Dannhauer Date: Mon, 24 Sep 2018 22:08:39 +0200 Subject: [PATCH] wrong viewTop calculation in certain situation If scrollContainer is set but not scrolled, window.pageYOffset is used as viewTop instead of the correct value '0'. This leads to elements in the viewport not being rendered initially in this situation. --- src/wow.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wow.coffee b/src/wow.coffee index 7acea88..b789935 100644 --- a/src/wow.coffee +++ b/src/wow.coffee @@ -276,7 +276,7 @@ class @WOW # check if box is visible isVisible: (box) -> offset = box.getAttribute('data-wow-offset') or @config.offset - viewTop = (@config.scrollContainer && @config.scrollContainer.scrollTop) || window.pageYOffset + viewTop = if @config.scrollContainer then @config.scrollContainer.scrollTop else window.pageYOffset viewBottom = viewTop + Math.min(@element.clientHeight, @util().innerHeight()) - offset top = @offsetTop(box) bottom = top + box.clientHeight