【发布时间】:2025-12-26 09:05:08
【问题描述】:
我有以下 javascript 代码。它做的一切都很好,除了我添加css类'progress-striped'和'active'的部分。它不显示活动的条纹进度条。
我在这里做错了什么?
<script type = 'text/javascript'>
$(document).ready(function(){
window.percent = 0;
window.progressInterval = window.setInterval(function() {
var $bar = $('.progress');
if(window.percent < 100) {
window.percent = (window.percent + 2);
$bar.addClass('progress-striped').addClass('active');
$bar.width(window.percent+'%');
$bar.text(window.percent+'%');
} else if(window.percent == 100) {
window.clearInterval(window.progressInterval);
jQuery('.progress').removeClass('active');
$bar.text('Done!');
}
}, 100);
});
【问题讨论】:
标签: javascript twitter-bootstrap progress-bar