,我調用的方法:jQuery選擇與許多功能無法正常工作
vm.progress = function() {
$('.progress-line').width('100%').animate({ width: 0 }, 5, 'linear', 1000);
}
HTML:
<div class="progress-outer">
<div class="progress-line red"></div>
</div>
CSS:
.progress-outer {
position: relative;
height: 10px;
width: 100%;
}
.progress-line {
position: absolute;
height: 100%;
width: 0;
}
它以動畫的進度條在5秒內從100%降至0。但它不起作用。但是,如果我將方法分成兩個函數並通過單擊按鈕(並且僅僅)來調用它們,它就可以工作。
請顯示html以及 –