diff --git a/js/scroll.js b/js/scroll.js index 738c470..6fd7033 100644 --- a/js/scroll.js +++ b/js/scroll.js @@ -1,12 +1,16 @@ -window.addEventListener("scroll", () => { - var winScroll = document.body.scrollTop || document.documentElement.scrollTop; - var height = document.documentElement.scrollHeight - document.documentElement.clientHeight; - var scrolled = (winScroll / height) * 100; - document.getElementById('progress').style.width = scrolled + "%"; +window.onload = (event) => { + if ((document.documentElement.scrollHeight / window.screen.availHeight ) > 1.5) { + window.addEventListener("scroll", () => { + var winScroll = document.body.scrollTop || document.documentElement.scrollTop; + var height = document.documentElement.scrollHeight - document.documentElement.clientHeight; + var scrolled = (winScroll / height) * 100; + document.getElementById('progress').style.width = scrolled + "%"; - const toTop = document.getElementById('totop'); + const toTop = document.getElementById('totop'); - if ((window.scrollY > 0 && !toTop.classList.contains("show")) || (window.scrollY <= 0 && toTop.classList.contains("show"))) { - toTop.classList.toggle("show"); + if ((window.scrollY > 0 && !toTop.classList.contains("show")) || (window.scrollY <= 0 && toTop.classList.contains("show"))) { + toTop.classList.toggle("show"); + } + }); } -}); \ No newline at end of file +} \ No newline at end of file diff --git a/public.zip b/public.zip index ca4fa4e..45c80b0 100644 Binary files a/public.zip and b/public.zip differ