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 –