/* * 进度条,目前只用于个人成绩页面 * quote by pjh */ $(document).ready(function () { var rotationMultiplier = 3.6; // For each div that its id ends with "circle", do the following. $( "div[id$='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 there's about a percentage class, take the actual percentage and apply the css transformations in all occurences of the specified percentage class, even for the divs without an id ending with "circle" */ 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)' }); } } }); });