0

jQuery UI 진행 막대를 사용한 적이 없지만 기본적으로 jQuery UI 진행률 막대를로드하고 5 초 동안 실행 한 다음 다른 기능을 실행하는 기능을 만들고 싶습니다.jQueryUI 진행 바

즉.

function test() { 

show the jQuery UI progress bar for 5 seconds in div ("progressbar") 

after 5 seconds has passed..... execute test2() 

} 

어떻게 수행 할 수 있습니까?

답변

0

당신은 이런 식으로 작업을 수행 할 수 있습니다 애니메이션

​<button onclick="test()">Test</button> 
<div id="progress"></div>​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​ 

:

function test(){ 
    var per = 0; 
    progress(per); 
    time = setTimeout(function(){ animate(per); }, 1000); 
    setTimeout(function(){ $("#progress").hide(); test2(); }, 5000); 

} 

function animate(per){ 

    clearTimeout(time); 
    per = per+20; 
    progress(per); 

    time = setTimeout(function(){ animate(per); }, 1000); 
} 

function test2(){ 
    alert('test2'); 
} 
function progress(per){ 
    $("#progress").progressbar({ 
     value: per 
    });   
} 

JSFiddle Example

관련 문제