Last Updated: February 25, 2016
·
627
· beuretv

infinit scroll ul li

Display content + 1 element if the scroll is 100% bottom every seconde and stop if all the elment of the list are display !

window.onload = function(){

var liens = document.getElementById("box").getElementsByTagName("li");
for(var i=3;i<liens.length;i++) {
liens[i].style.display = "none";
liens[i].className = 'contactsSheetsHide';
   }




var list = document.getElementById("box").getElementsByTagName("li");

var fulllist = list.length; //full child

var $win = $(window);

var number = 3; 

var timer = window.setInterval(function(){

        if ($win.scrollTop() == 0){
        }
        else if ($win.height() + $win.scrollTop() == $(document).height()) {

            var reint = "0";

            var liens = document.getElementById("box").getElementsByTagName("li");
                for(var i=reint;i<liens.length;i++) {
                liens[i].style.display = "block";
            }

            number++;

           var liens = document.getElementById("box").getElementsByTagName("li");
                for(var i=number;i<liens.length;i++) {
                liens[i].style.display = "none";
            }

            if(fulllist <= number){window.clearInterval(timer);alert('fin');}
    }

},1000);

}