1
我有这个Javascript功能。当我点击一个按钮时,按钮消失并显示一个进度条。我如何注册时间到并运行另一个功能?如何注册进度条已完成并运行其他功能?
$('#go').click(function() {
console.log("moveProgressBar");
$('.progress-wrap').removeClass('hidden');
var getPercent = ($('.progress-wrap').data('progress-percent')/100);
var getProgressWrapWidth = $('.progress-wrap').width();
var progressTotal = getPercent * getProgressWrapWidth;
var animationLength = 1000;
$('.progress-bar').stop().animate({
left: progressTotal
}, animationLength);
$('#go').addClass('hidden');
});
http://codepen.io/TrueVineCS/pen/vuyxC
动画的方法接受一个完整的回调,检查DOC –