traffic-counter/assets/plugin/percircle/js/percircle.js

21 lines
851 B
JavaScript
Raw Normal View History

$(document).ready(function () {
var rotationMultiplier = 3.6;
$( ".js__circle" ).each(function() {
// Save all of its classes in an array.
var classList = $( this ).attr('class').split(/\s+/);
// Iterate over the array
for (var i = 0; i < classList.length; i++) {
if (classList[i].match("^p")) {
var rotationPercentage = classList[i].substring(1, classList[i].length);
var rotationDegrees = rotationMultiplier*rotationPercentage;
$('.c100.p'+rotationPercentage+ ' .bar').css({
'-webkit-transform' : 'rotate(' + rotationDegrees + 'deg)',
'-moz-transform' : 'rotate(' + rotationDegrees + 'deg)',
'-ms-transform' : 'rotate(' + rotationDegrees + 'deg)',
'-o-transform' : 'rotate(' + rotationDegrees + 'deg)',
'transform' : 'rotate(' + rotationDegrees + 'deg)'
});
}
}
});
});