무한 스크롤 제이쿼리

Web Development assistant·2022년 7월 20일
0

# javascript

목록 보기
28/35
$(window).scroll(function(){
  var scrollTop = $(window).scrollTop();
  var innerHeight = $(window).innerHeight();
  var scrollHeight = $('body').prop('scrollHeight');
  var cardCnt = $('.card').length;
  
  if ($('#projectListArea').is(':visible') && (Math.ceil(scrollTop + innerHeight) >= (scrollHeight - 100)) && !oneTime) {
    if(cardCnt === totalCnt) {
       return false;
    }
    
    page += 1;
    oneTime = true;
    
    getFreeList();
  }
});

$(document).ready(function(){
//.......
});
밖으로 빼라

0개의 댓글