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
Post a Comment