2013-12-16 7 views
-1

RoundAbout 플러그인을 사용하여 자동 실행 슬라이드 쇼를 만들고 있습니다. 괜찮 으면 좋겠지 만 몇 초 후에 자동 재생을 중지하고 싶습니다. 나는 설명서를 읽고 "autoplayDuration"을 시도했지만 보이지는 않습니다 : Pjquery - 10 초 후 자동 재생 중단 - RoundAbout

그래서 팁이나 힌트를 어떻게 할 수 있습니까? 감사합니다. .

답변

0

시작할 때 콜백을 사용합니다. 뭔가 같은 :

function stopRoundaboutAfterAWhile() { 
    setTimeout(function() { 
     .roundabout("stopAutoplay"); 
    }, 10000); 
} 

.roundabout(options, stopRoundaboutAfterAWhile) 
0

내 솔루션은이 페이지를 준비하고 setTimeout과 혼합 할 때 autoplay를 호출합니다.

또한 자동 재생을 임의의 초 단위로 중지하고 div ID를 localStorage에 저장했습니다.

$(window).load(function() { 
      $('ul').roundabout(); 
      $('ul').roundabout('startAutoplay'); 

      var tempo = Math.floor(Math.random()*(10000-5000+1))+5000; 

      setTimeout(function(){ 
       $('ul').roundabout('stopAutoplay'); 
      }, tempo); 

      setTimeout(function(){ 
       console.log($('.roundabout-in-focus').attr('id')); 
       window.localStorage.setItem('vilao',$('.roundabout-in-focus').attr('id')); 
      }, tempo + 1000); 

    }); 
관련 문제