jquery - Incremental Transform Rotation -
i'd button rotate element 5 additional degrees each time it's clicked. i've been able sort of thing border width like
$(document).on('click', '.brdr_width_up', function() { $(ws.currentcell).css({'border-top-width' : '+=1', 'border-right-width' : '+=1','border-bottom-width' : '+=1','border-left-width' : '+=1'}); });
but same idea doesn't seem work transform:rotate:
$(document).on('click', '.rotate_cw', function() { $(ws.currentcell).css({'-webkit-transform': 'rotate(+=5deg)'}); $(ws.currentcell).css({'-moz-transform': 'rotate(+=5deg)'}); var deg = $(ws.currentcell).css({'-moz-transform': 'rotate()'}); });
and var line above doesn't bring current rotation add it.
does know way this?
thanks
if don't want messing around matrix, can use data attribute keep track of rotation, , more this:
$(document).on('click', '.rotate_cw', function() { var r = $(ws.currentcell).data('rot') + 5; $(ws.currentcell).css({ '-webkit-transform': 'rotate('+r+'deg)', '-moz-transform': 'rotate('+r+'deg)', '-ms-transform': 'rotate('+r+'deg)', '-o-transform': 'rotate('+r+'deg)', 'transform': 'rotate('+r+'deg)' }).data('rot', r); });
Comments
Post a Comment