【问题标题】:Twitter-Bootstrap progress bar 100% every x amount of secondsTwitter-Bootstrap 进度条每 x 秒 100%
【发布时间】:2012-10-27 21:30:19
【问题描述】:

是否可以让 Bootstrap 进度条每隔 5 秒达到 100%

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

进度条是通过宽度样式填充的,所以上面会显示完成 40%

如何让它在 5 秒内顺利加载到 100%,然后重置回 0 并重新开始,重复?

谢谢。

【问题讨论】:

标签: javascript css twitter-bootstrap


【解决方案1】:

在这个答案中,我稍微修改了@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();
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-10-07
    • 2013-08-29
    • 1970-01-01
    • 1970-01-01
    • 2012-06-07
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多