samedi 25 avril 2015

How to end JQuery endless scroll


I know this topic is overflowing on this site however when using the endless scroll plugin below I was hoping to figure out a way of just loading from my ajax request but somehow just ending at some point. e.g. eventually reaching the bottom? Any help is much 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 to show.</center>');
        }
    }
    });
    }
});
</script>


Aucun commentaire:

Enregistrer un commentaire