2014-03-29 28 views
0
function startSlideshow() { 
    var timerSlide; 
    $('.progressbar').animate({"width":"100%"}, 1000); 

    timerSlide = window.setInterval(
    function() {  
    $('.' + currentImage).css("display","none").fadeTo(3000,0).queue(function() { 
     currentImage += 1; 
     $("." + currentImage).css("display","block").fadeTo(3000,1).dequeue; 
    }); 
    }, 20000); 

} 
window.onload=startSlideshow(); 

HTML.animate jQuery是未觸發

<div class="progressbar" style="background-color: #e17904; height: 7px; width: 1%; left: 0px; position: absolute;"></div> 

幻燈片的setInterval在工作(作爲圖像變化,但progressbars寬度不改變..)

+1

代碼中的currentImage是什麼? – Unknown

+0

嘗試動畫({width:$('。progressbar').width()* 100},1000);作爲測試,看看它是否有效。 – lshettyl

+0

http://jsfiddle.net/D698L/它的工作不是嗎? –

回答