0

I have an infinite scroll with this system. However, it doesn't work on a mobile browser.

How can I get it to work on mobile?

function appendNewLine(){
  $("#article").append("maindiv new add<br>");
  
}

$(window).on('scroll', function () {
        var doch = $(document).innerHeight(); 
        var winh = $(window).innerHeight(); 
        var bottom = doch - winh; 
        if (bottom <= $(window).scrollTop()) {
            console.log("Bottom at");
            appendNewLine();
        }
    });
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div id="article">
main line1<br>
main line2<br>
main line3<br>
main line4<br>
main line5<br>
main line6<br>
main line7<br>
main line8<br>
main line9<br>
main line10<br>
main line11<br>
main line12<br>
main line13<br>
main line13<br>
main line14<br>
main line15<br>
main line16<br>
main line17<br>
main line18<br>
main line19<br>
main line20<br>


</div>
whitebear
  • 11,200
  • 24
  • 114
  • 237

0 Answers0