diff --git a/index.php b/index.php index a56afa8..1814679 100644 --- a/index.php +++ b/index.php @@ -37,31 +37,18 @@ }); $(window).scroll(function() { - if (isInViewport(document.querySelector('footer'))) - { - //blockchainExplorer.addBottomBlock(); - console.log("Scroll to footer detected !"); - } + var element = document.getElementById('blockchain'); + var offset = element.getBoundingClientRect().top - element.offsetParent.getBoundingClientRect().top; + const top = window.pageYOffset + window.innerHeight - offset; - if ((window.innerHeight + window.scrollY) >= document.body.offsetHeight) { - // blockchainExplorer.addBottomBlock(); - console.log("Scroll to footer detected !"); - } - - $(".slideanim").each(function(){ - var pos = $(this).offset().top; - var winTop = $(window).scrollTop(); - if (pos < winTop + 600) { - blockchainExplorer.addBottomBlock(); - $(this).addClass("slide"); - } - }); - + if (top === element.scrollHeight) { + console.log("bottom"); + blockchainExplorer.addBottomBlock(); + } }); - blockchainExplorer.init(0); + showInfos(); - //toggleInfos(); }); var isInViewport = function (elem) { @@ -76,13 +63,7 @@ function showInfos() { - var flag = 2*parseInt($('#mode_selector').val()); - - $('#blockchain').html(''); - - if ($('#mode_checkbox').is(":checked")) flag += 1; - - blockchainExplorer.init(flag); + blockchainExplorer.init(parseInt($('#mode_selector').val())); } function toggleInfos() @@ -122,7 +103,7 @@