2011-09-06 3 views
0

iam에 대해 jquery timer http://jquery.offput.ca/timers/을 사용하여 매 5 초마다 문서를 만들고 제어 된 일시 중지 및 다시 시작 버튼을 사용하여 혼동 스럽습니다. 이미 일시 정지 버튼 통제 할에 매 5 초로드 문서를 작성하고,이 스크립트와Jquery 타이머

$(function() { 
      $('.handler').load("../Pages/csFetchCustomer.ashx?"); 
      $('.controlled-interval').everyTime(5000, 'controlled', function() { 
       $('.handler').load("../Pages/csFetchCustomer.ashx?"); 
       $('.stop').click(function() { 
        $('.controlled-interval').stopTime('controlled'); 
       }); 
      }); 
     }); 

,. : 여기 내 스크립트입니다 이력서/재생 버튼 컨트롤을 만드는 방법은 무엇입니까? 어떤 제안든지 환영합니다 감사합니다.

답변

1

이 당신이 원하는 무엇을하고있는 자신의 사이트에 작업 데모는,하지만 여기에 내 코드를 단순화 것 :

$(document).ready(function() { 
    var active = true, 
     runLoadEvery = function() { 
      $('.controlled-interval').everyTime(5000, 'controlled', function() { 
       $('.handler').load("../Pages/csFetchCustomer.ashx?");      
      }); 
     }; 
    // start running as soon as ready event is fired 
    runLoadEvery(); 

    $('.start').click(function() { 
     active = true; 
     runLoadEvery(); 
    }); 
    $('.stop').click(function() { 
     active = false; 
     $('.controlled-interval').stopTime('controlled'); 
    }); 
}); 
+0

작업 완벽 .. 감사합니다 많이 WTK를. 스크립트는 정말 이해하기 쉽습니다. – syads321

+0

그냥 호기심, runLoadEvery() 실행하는 방법; 문서 준비 이벤트에서 작동합니까? 아니면 그것에 대해 말하는 모든 문서? 어쨌든 감사합니다. – syads321

+0

답변을 업데이트했습니다. – WTK