From 6c1d6fe359068427403c7a0326774a6b1a7768c6 Mon Sep 17 00:00:00 2001 From: alexcherman Date: Wed, 30 May 2018 10:51:59 +0200 Subject: [PATCH] fixed onscroll button bug --- js/main.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/js/main.js b/js/main.js index a066ef23ac..97139f6542 100644 --- a/js/main.js +++ b/js/main.js @@ -623,8 +623,14 @@ function onScrollButton() { function stickyButton() { if (document.documentElement.clientWidth <= 640) { + if (buttonTop === 0) { + buttonTop = button.offsetTop; + } var footerTop = document.querySelector(".footer").offsetTop; + console.log(buttonTop); + + // Fixed menu if (window.scrollY >= buttonTop && window.scrollY + buttonHeight <= footerTop) { button.classList.add("is-fixed");