infinite scroll not working



  • Hello,

    I added infinite scroll to my app but it is not working I don’t know why

    <ons-template id="home.html">
        <ons-page id="mypage">
          <div id="divContent"></div>
        </ons-page>
    </ons-template>
    <script>
    $('document').ready(function () {
            document.addEventListener('init', function (event) {
                var page = event.target;            
                if (page.matches('#mypage')) {                
                    // Load more                
                    page.onInfiniteScroll = function (done) {
           alert('hi');
                        done();
                    };
                }
            });  
        });
    </script>
    

  • Onsen UI

    @Ahmed-Elshorbagy You don’t need to wait unttil the document is ready to set a listener. Add a console.log or anything there to make sure the init handler is running so we know if the problem is in your app or in the infinite scroll feature side.



  • I moved the alert message after page.matches and it worked, the problem is in page.onInfiniteScroll



  • still not working


  • Onsen UI

    @Ahmed-Elshorbagy Looks like it works well when I try. Example here.


Log in to reply