,我调用的方法: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以及 –