Detect scroll to footer

This commit is contained in:
2019-12-21 20:02:46 +01:00
parent 8621260f26
commit 0684c9c627

View File

@@ -33,6 +33,12 @@
}); });
$(window).scroll(function() { $(window).scroll(function() {
if (isInViewport(document.querySelector('footer')))
{
blockchainExplorer.addBottomBlock();
console.log("Scroll to footer detected !");
}
/*
$(".slideanim").each(function(){ $(".slideanim").each(function(){
var pos = $(this).offset().top; var pos = $(this).offset().top;
var winTop = $(window).scrollTop(); var winTop = $(window).scrollTop();
@@ -41,11 +47,22 @@
$(this).addClass("slide"); $(this).addClass("slide");
} }
}); });
*/
}); });
blockchainExplorer.init(1); 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) function showInfos(element)
{ {
$('#blockchain').html(''); $('#blockchain').html('');