相关js代码$(".buttonContainer").click(function(){ if($(".buttonContainer").hasClass("active")){ $(this).removeClass("active"); $(".complete").removeClass("fadein"); $("#counter").fadeOut(100); $(".ball").fadeOut(100); count().stop; } else{ $(this).addClass("active"); $("#counter").fadeIn(200); $(".ball").fadeIn(200); count(); }});//Loadingfunction count(){ $({countNum: $("#counter").text()}).animate({countNum: 100}, { duration: 5000, easing:"linear", step: function() { $("#counter").text(Math.floor(this.countNum) + "%"); }, complete: function() { $("#counter").fadeOut(200); $(".complete").addClass("fadein"); $(".ball").fadeOut(200); $("#button").fadeOut(100); setTimeout(function() { $(".buttonContainer").removeClass("active"); $(".complete").removeClass("fadein"); $("#button").fadeIn(200); }, 1000); } });}

dd:
这段代码实现了一个按钮点击事件,当按钮被激活时,会显示进度条动画,从0%渐变到100%,并在完成后淡出。动画时长为5秒,完成后按钮将重置状态。
1068

被折叠的 条评论
为什么被折叠?



