SoFunction
Updated on 2025-04-10

Percent dynamic color strip plugin created based on jquery


; (function ($) {
$. = function (o) {
var options1 = $.extend({
percent:[],//scale array, such as: [0.5, 0.4, 0.6] If the length is greater than 1, the proportion is distributed in order
bar_bgcolor:'#EFEFEF',//Background color of color bar
bar_bordercolor:'#E2E2E2',//Border color of color bar
bar_borderwidth:1,//Borderwidth of color bar border width
width:250,//Width of color bar
height:14,//Height of color bar
callback:function(){}//l callback function (after the color bar is displayed)
},o);
var g=;
var styleData=InitColor();
$(this).css({ "background": "none repeat scroll 0 0 #EFEFEF", "border": "1px solid #E2E2E2" ,"height": +"px","width": +"px","background-color":options1.bar_bgcolor,"border-color":options1.bar_bordercolor,"border-width":options1.bar_borderwidth+"px"});
$(this).each(function(index, element) {
$(element).append(" <p style=\"float: left; margin: 0;padding: 0;\"><span style=\"float: left;height: "++"px;overflow: hidden;background-color:"+styleData[index]+";width:0px\"></span></p>");
if(g==index+1)
{
$(element).find("span").animate({ width: ([index] * ) }, "slow",)
}else
{
$(element).find("span").animate({ width: ([index] * ) }, "slow")
}
});
//Initialize the color bar
function InitColor() {
var o = [];
var n = ["#5dbc5b", "#6c81b6", "#9eb5f0", "#a5cbd6", "#aee7f8", "#c2f263", "#d843b3", "#d8e929", "#e58652", "#e7ab6d", "#ee335f", "#fbe096", "#ffc535"];
var q = ();
for (var p = 0, l = g; p < l; p++) {
var k = (() * );
(q[k]);
(k, 1);
if ( == 0) {
q = ()
}
}
return o
}
}
})(jQuery);