-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathjquery.thermometer.js
2 lines (2 loc) · 1.07 KB
/
jquery.thermometer.js
1
2
/* jQuery.thermometer | Version: 1.0 (11-AUG-2013) | https://github.com/noahcooper/jQuery.thermometer/blob/master/MIT-LICENSE.txt */
(function(e){e.fn.thermometer=function(t){var n=e.extend({percent:0,orientation:"horizontal",animate:true,speed:1e3},t||{});return this.each(function(){var t=e(this).data("percent")||n.percent,r=e(this).data("orientation")||n.orientation,i=e(this).data("animate")===false?false:n.animate,s=e(this).data("speed")||n.speed;r=r.toLowerCase()==="vertical"?"v":"h";if(isNaN(t)||t<0){t=0}else if(t>100){t=100}if(e.type(s)==="string"&&s.toLowerCase()==="slow"){s=1500}e(this).html('<div class="thermometer-outer thermometer-outer-'+r+'">'+'<div class="thermometer-inner thermometer-inner-'+r+'">'+"</div>"+"</div>");var o=i?0:t+"%";if(r==="v"){e(this).find(".thermometer-outer").css("position","relative");e(this).find(".thermometer-inner").css({position:"absolute",bottom:"0",height:o})}else{e(this).find(".thermometer-inner").css("width",o)}if(i){var u={};if(r==="v"){u.height=t+"%"}else{u.width=t+"%"}e(this).find(".thermometer-inner").animate(u,s)}})}})(jQuery)