javascript - How to end JQuery endless scroll -


i know topic overflowing on site when using endless scroll plugin below hoping figure out way of loading ajax request somehow ending @ point. e.g. reaching bottom? appreciated?

     <script type="text/javascript"> $(window).scroll(function() {     if($(window).scrolltop() == $(document).height() - $(window).height()) {     $('div#loadmoreajaxloader').show();     $.ajax({     url: "{{url('contentpage')}}",     success: function(html)     {         if(html)         {             $("#postswrapper").append(html);             $('div#loadmoreajaxloader').hide();         }else         {             $('div#loadmoreajaxloader').html('<center>no more posts show.</center>');         }     }     });     } }); </script> 

try this,

var cp = 1; var pagestotal = $("div.page-nav").find("a.pag:last").text();  function() {  // optional callback when new content loaded          cp++;          if(cp == pagestotal) {              $(window).unbind('.infscr');          } else {} 

Comments

Popular posts from this blog

jquery - How do you format the date used in the popover widget title of FullCalendar? -

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -