2014-10-03 3 views
-1

그래서 내가 묻고있는 질문은 jRibbble 플러그인을 사용하여 더 많은 샷을로드하는 방법입니다. 슬프게도, 나는이 주제에서 나에게 의미있는 것을 찾을 수 없었다. 약 1 주일 만 자바 스크립트를 사용 했으므로 서툴러 보인다면 사과드립니다. 나는 누군가가 적어도 일부 포인터를 제공 할 수 있다면 나는 것 얼마나 감사 언급 할 필요가 있다고 생각하지 않는다Jribbble을 사용하여 더 많은 샷 가져 오기

$(document).ready(function() { 
    // this is jRibbble example code if I recall correctly 
    $.jribbble.getShotsByPlayerId('name', function (playerShots) { 
     var html = []; 

     $.each(playerShots.shots, function (i, shot) { 
      html.push('<li><a href="' + shot.url + '">'); 
      html.push('<img src="' + shot.image_url + '" alt="' + shot.title + '"></a></li>'); 
     }); 

     $('#grid').html(html.join('')); 
    }, {page: 1, per_page: 6}); 

    $(window).on('load resize', function() { 
     window.shotHeight = $('#grid li').outerHeight(true); 
    }); 
}); 

$(window).scroll(function() { 
    if ($(window).scrollTop() + shotHeight > $(document).height() - $(window).height()) { 
     // so that there's a time buffer between the time of request and when the user reaches the bottom of the page (and thus expects new posts) 
    } 
}); 

다음과 같이 내 코드는 지금까지입니다.

참고 : 이미 downvote를 받았기 때문에 몇 가지 지침을 얻고 싶습니다. 자신을 코딩하기에는 너무 게을러서는 안된다고 설명하고 싶습니다.

답변

0

내 질문에 대한 답변을 찾았습니다. 필자가해야 할 일은 getShotsByPlayer를 다시 실행하여 매번 'per_page'를 늘리는 것입니다. 그런 다음 두 배열을 병합하십시오. 나는 이것을 알아야했다.

관련 문제