1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
|
document.addEventListener("DOMContentLoaded", function(event) { var angle = [0, 15, 30, 45, 60, 75, 90, 105, 120, 135, 150, 165, 180, 195, 210, 225, 240, 255, 270, 285, 300, 315 , 330, 345, 360]; var current = 0; jQuery(document).on('click','.table > .rotateright',function(event) { current++; if(current == 25) { current = 0; } var r = jQuery(this).parents('.table').attr('id'); var rotating = '#'.concat(r); console.log(angle[current]); jQuery(rotating).css({ '-webkit-transform' : 'rotate(' + angle[current] + ')', '-moz-transform' : 'rotate(' + angle[current] + ')', '-ms-transform' : 'rotate(' + angle[current] + ')', '-o-transform' : 'rotate(' + angle[current] + ')', 'transform' : 'rotate(' + angle[current] + ')' }); }); jQuery(document).on('click','.table > .rotateleft',function(event) { current--; if(current == -1) { current = 24; } var r = jQuery(this).parents('.table').attr('id'); var rotating = '#'.concat(r); console.log(angle[current]); jQuery(rotating).css({ '-webkit-transform' : 'rotate(' + angle[current] + ')', '-moz-transform' : 'rotate(' + angle[current] + ')', '-ms-transform' : 'rotate(' + angle[current] + ')', '-o-transform' : 'rotate(' + angle[current] + ')', 'transform' : 'rotate(' + angle[current] + ')' }); }); }); |