1/*! 2 * https://github.com/umarwebdeveloper/jquery-css-skills-bar 3 * Author: @umarwebdeveloper 4 * Licensed under the MIT license 5 */ 6 7(function ( $ ) { 8 9 $.fn.skillBars = function( options ) { 10 11 var settings = $.extend({ 12 from: 0, // number start 13 to: false, // number end 14 speed: 1000, // how long it should take to count between the target numbers 15 interval: 100, // how often the element should be updated 16 decimals: 0, // the number of decimal places to show 17 onUpdate: null, // callback method for every time the element is updated, 18 onComplete: null, // callback method for when the element finishes updating 19 /*onComplete: function(from) { 20 console.debug(this); 21 }*/ 22 classes:{ 23 skillBarBar : '.skillbar-bar', 24 skillBarPercent : '.skill-bar-percent', 25 } 26 }, options ); 27 28 return this.each(function(){ 29 30 var obj = $(this), 31 to = (settings.to != false) ? settings.to : parseInt(obj.attr('data-percent')); 32 if(to > 100){ 33 to = 100; 34 }; 35 var from = settings.from, 36 loops = Math.ceil(settings.speed / settings.interval), 37 increment = (to - from) / loops, 38 loopCount = 0, 39 interval = setInterval(updateValue, settings.interval); 40 41 obj.find(settings.classes.skillBarBar).animate({ 42 width: parseInt(obj.attr('data-percent'))+'%' 43 }, settings.speed); 44 45 function updateValue(){ 46 from += increment; 47 loopCount++; 48 $(obj).find(settings.classes.skillBarPercent).text(from.toFixed(settings.decimals)+'%'); 49
50 if (typeof(settings.onUpdate) == 'function') { 51 settings.onUpdate.call(obj, from); 52 } 53 54 if (loopCount >= loops) { 55 clearInterval(interval); 56 from = to; 57 58 if (typeof(settings.onComplete) == 'function') { 59 settings.onComplete.call(obj, from); 60 } 61 } 62 } 63 64 }); 65 66 }; 67 68}( jQuery ));
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.