簡體   English   中英

Twitter-Bootstrap進度條每x秒數100%

[英]Twitter-Bootstrap progress bar 100% every x amount of seconds

每5秒說一次Bootstrap進度條是否有可能達到100%

    <div class="progress progress-striped active">
      <div class="bar" style="width: 40%;"></div>
        </div>

進度欄通過寬度樣式填充,因此上面將其設置為40%完成

如何使它在5秒鍾內平穩加載到100%,然后重設為0,然后再次重復啟動?

謝謝。

在此答案中,我對@Blender的方法進行了一些修改以使其永久運行。

為此,我使用了animate函數的complete參數。
http://jsfiddle.net/xXM2z/490/
完整的JS代碼:

$(document).ready(function(){
   animateScroll();
});

function animateScroll()
    {
    $('.bar').animate({
    width: '100%'
}, {
    duration: 5000,
    easing: 'linear',
    complete:function(){ $(this).css("width","0%");
   }
});
animateScroll();
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM