From 0684c9c627bbcb0e9f3fa64c98346243ad4b2eac Mon Sep 17 00:00:00 2001 From: MEUNIER Thibaud Date: Sat, 21 Dec 2019 20:02:46 +0100 Subject: [PATCH] Detect scroll to footer --- index.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/index.php b/index.php index e539d1d..f12fa21 100644 --- a/index.php +++ b/index.php @@ -33,6 +33,12 @@ }); $(window).scroll(function() { + if (isInViewport(document.querySelector('footer'))) + { + blockchainExplorer.addBottomBlock(); + console.log("Scroll to footer detected !"); + } + /* $(".slideanim").each(function(){ var pos = $(this).offset().top; var winTop = $(window).scrollTop(); @@ -41,11 +47,22 @@ $(this).addClass("slide"); } }); + */ }); blockchainExplorer.init(1); }); + var isInViewport = function (elem) { + var bounding = elem.getBoundingClientRect(); + return ( + bounding.top >= 0 && + bounding.left >= 0 && + bounding.bottom <= (window.innerHeight || document.documentElement.clientHeight) && + bounding.right <= (window.innerWidth || document.documentElement.clientWidth) + ); + }; + function showInfos(element) { $('#blockchain').html('');