/* Title: jQMeter: a jQuery Progress Meter Plugin Author: Gerardo Larios Version: 0.1.2 Website: http://www.gerardolarios.com/plugins-and-tools/jqmeter License: Dual licensed under the MIT and GPL licenses. */ !function (e) { e.fn.extend({ jQMeter: function (t) { t && "object" == typeof t && (t = e.extend({}, e.jQMeter.defaults, t)), this.each(function () { new e.jQMeter(this, t) }) } }), e.jQMeter = function (t, r) { e(t).children(".outer-therm").children(".inner-therm").children().text('');//清空 if (goal = parseInt(r.goal.replace(/\D/g, "")), raised = r.raised, width = r.width, height = r.height, bgColor = r.bgColor, barColor = r.barColor, orientation = r.orientation, animationSpeed = r.animationSpeed, counterSpeed = r.counterSpeed, displayTotal = r.displayTotal, total = raised / goal * 100, total >= 100 && (total = 100), "vertical" == orientation ? (e(t).html('
' + raised + "
"), e(t).children(".outer-therm").attr("style", "width:" + width + ";height:" + height + ";background-color:" + bgColor), e(t).children(".outer-therm").children(".inner-therm").attr("style", "background-color:" + barColor + ";height:0;width:" + width), e(t).children(".outer-therm").children(".inner-therm").animate({height: total + "%"}, animationSpeed)) : (e(t).html('
' + raised + "
"), e(t).children(".outer-therm").attr("style", "width:" + width + ";height:" + height + ";background-color:" + bgColor), e(t).children(".outer-therm").children(".inner-therm").attr("style", "background-color:" + barColor + ";height:" + height + ";width:0"), e(t).children(".outer-therm").children(".inner-therm").animate({width: total + "%"}, animationSpeed)), displayTotal) { var i = parseInt(height), n = i / 2 - 13 + "px 10px"; "horizontal" != orientation && (n = "10px 0"), e(t).children(".outer-therm").children(".inner-therm").children().show(), e(t).children(".outer-therm").children(".inner-therm").children().css("padding", n), e({Counter: 0}).animate({Counter: e(t).children(".outer-therm").children(".inner-therm").children().text()}, { duration: counterSpeed, easing: "swing", step: function () { let count = this.Counter; if (r.raised.indexOf(".") != -1) { count = Math.round(count * 100) / 100; } else { count = Math.ceil(count); } e(t).children(".outer-therm").children(".inner-therm").children().text(count + "%"); } }) } e(t).append("") }, e.jQMeter.defaults = { width: "100%", height: "50px", bgColor: "#444", barColor: "#bfd255", orientation: "horizontal", animationSpeed: 2e3, counterSpeed: 2e3, displayTotal: !0 } }(jQuery);