2012-04-15 5 views
0

내 웹 사이트에 Wookmark jQuery 격자 레이아웃을 사용하고 있습니다.jquery Wookmark Plugin 무한로드/Scoll

https://github.com/GBKS/Wookmark-jQuery

나는 작업을 자동로드/무한 스크롤이 필요합니다.

예를 들어, 처음 10 개의 이미지를 다시로드하기 만하면 Wookmark.com 및 Pinterest.com에서 나머지 목록을 계속로드하는 방법은 무엇입니까?

변경을 시도하고 필자의 코드 부분 : 사전에

/** 
* When scrolled all the way to the bottom, add more tiles. 
*/ 
function onScroll(event) { 
    // Check if we're within 100 pixels of the bottom edge of the broser window. 
    var closeToBottom = ($(window).scrollTop() + $(window).height() > $(document).height() - 100); 
    if(closeToBottom) { 
    // Get the first then items from the grid, clone them, and add them to the bottom of the grid. 
    var items = $('#tiles li'); 
    var firstTen = items.slice(0, 10); 
    $('#tiles').append(firstTen.clone()); 

    // Clear our previous layout handler. 
    if(handler) handler.wookmarkClear(); 

    // Create a new layout handler. 
    handler = $('#tiles li'); 
    handler.wookmark(options); 
    } 
}; 

감사합니다. Ive는 도처에 보았고, 약간의 다른 물건을 시험해 보았다. 그러나 어떤 운도. 건배.

답변

5

정확히 GitHub 저장소에 예제를 추가했습니다. 이 예제는 Wookmark API에서 데이터를로드하고 페이지에 이미지를 표시합니다. 아래로 스크롤하여 바닥에 도달하면 더 많이로드됩니다.

다음의 예와 직접 링크는 다음과 같습니다 https://github.com/GBKS/Wookmark-jQuery/tree/master/example-api

이 당신을 위해 밖으로 작동하는 방법을 알려주세요.

+0

감사합니다. 너의 전설! 정확히 내가 뭘하는지. 이제 JSONP 용 API를 만드는 방법을 모색 중입니다. JSONP 초보자를위한 좋은 사이트가 있습니까? – Anthony1234

+0

JSON을 해결하고 POST를 사용하여 이미지 및 컨트롤 등을 가져 오도록 변경했습니다. Internet Explorer 8에서 작동하지 않는다고 생각하는 경우 GBKS를 궁금해하십니까? 이 문제가 있었나요? 첫 번째 부분을로드하지만 스크롤에서는 아무 것도 작동하지 않습니다. 너는 어떤 종류의 문제를 안다? 고마워. – Anthony1234