【发布时间】:2014-07-30 03:23:36
【问题描述】:
我正在开发一款脑力锻炼类型的游戏 (add1.herokuapp.com),玩家离开的时间有时间限制。我想用bootstrap进度条来实现这个,通过覆盖bootstrap CSS中的transition-duration属性基本实现了这个效果
custom.css
.progress-bar {
-webkit-transition: width 5s linear;
-o-transition: width 5s linear;
transition: width 5s linear;
}
当我想将此进度条设置为零时出现问题(播放应用程序以查看此操作)。即使通过角度数据绑定将宽度设置为零,引导进度条也不会回到 0%。
game.html
<div class="progress">
<div class="progress-bar" role="progressbar" aria-valuenow="{{progressNum}}" aria-valuemin="0" aria-valuemax="100" style="width: {{progressNum}}%;">
<span class="sr-only">{{progressNum}}% Complete</span>
</div>
</div>
game.js
//When I call setTimer, I call this
$scope.progressNum = 100;
//When I want to reset for the next problem, I call this
$scope.progressNum = 0;
我的猜测是,即使 progressNum 发生变化,bootstrap 也不会反映这些变化。有没有办法解决这个问题?
【问题讨论】:
标签: javascript angularjs twitter-bootstrap