2012-08-07 3 views
1

슬라이드 세트를 몇 번 통과 한 다음 첫 번째 슬라이드에서 돌아가서 멈추는 방법을 찾으려고합니다.jQueryTools Scrollable - 첫 번째 슬라이드에서 두 번 반복하면 멈 춥니 다.

현재, 내가 가진 :

$('#con_featured .scrollable').scrollable({ 
    circular: false 
}).navigator({ 
    activeClass: 'current', 
    navi:'#con_featured .scrollable_nav ul' 
}).autoscroll({ 
    autoplay: true, 
    interval: 8000 
}); 

나는 슬라이더의 시작 부분으로 다시 이동하는 방법에 대한 article을 발견했다. 그리고 각 항목이 스크롤 된 후에 발생하는 "onSeek"이벤트를 보았습니다. 슬라이드가 끝나는 시간을 찾기 위해 그 (또는 다른 이벤트 리스너)를 사용할 수 있습니까?

답변

1

동료가 Scrollable API을 사용하여 문제를 해결할 수있었습니다. API를 사용하여 슬라이더의 색인을 가져올 수 있었고 두 번 재생 한 후 첫 번째 슬라이드에서 중지합니다.

var loopCounter = 0; 
$('#con_featured .scrollable').scrollable({ 
    onSeek: function() { 
     var api = $('#con_featured .scrollable').data("scrollable"); 

     if(api.getIndex() == 0) { 
      loopCounter++; 
      if(loopCounter >= 2) api.stop(); // loops twice then stops 
     } 
    }, 
    circular: true 
}).navigator({ 
    activeClass: 'current', 
    navi:'#con_featured .scrollable_nav ul' 
}).autoscroll({ 
    autoplay: true, 
    interval: 8000 
});