Please lazyload jquery | as long as the scroll is at the bottom, you will always ask for it from the back end, but there is no data available.

$(window).scroll(function(){
  var WindowHeight = $(window).height();

  if($(window).scrollTop() >= $(document).height() - WindowHeight){

    $("-sharploader").html("<img src="../images/loading_v2.svg">");

    var LastDiv = $(".data-display:last");
    var LastId  = $(".data-display:last").attr("id");
    var ValueToPass = "lastid="+LastId;

    $.ajax({
      type: "POST",
      url:"/module/user/order/lazyload.app",
      data: ValueToPass,
      cache: false,
      success: function(data){
        if(data != ""){
          LastDiv.after(data);
        }else{
          $("-sharploader").html("");
        }
      }
    });
  }
  return false;
});

what a strange image. I don"t know where I wrote
. As long as the scroll goes to the bottom, I won"t keep asking for it, but obviously I don"t have any data, so I have to go up scroll a little bit before I can see that there are no more .
otherwise, he will keep showing "" loading stories, and then disappear, then show loading symptoms, disappear again, and repeat them all the time

.
May.24,2021

this code itself does not judge that loading will no longer be triggered when there is no data. As mentioned above, you can add a flag to determine.
for example, add:

to the top of scroll.
if($('-sharploader').hasClass('nomore')) {
    return false;
}

when requesting numerous data:

$('-sharploader').addClass('nomore').html('');

itself needs to add another flag, whether it is loading.


. It may be that scroll is triggered multiple times, resulting in multiple requests. Try to set a flag bit. Check the flag bit before each request to determine whether you are requesting it or not. Add the throttle function to scroll.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b324bb-2be06.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b324bb-2be06.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?