RSS Feed

February, 2010

  1. Rotate

    February 25, 2010 by pfranzen

    This is the right way to rotate a dom object in FF, using jQuery, of course, it can easily be ported to work with IE, but that’s up to you.

    var angle = 40*Math.PI/180;
    var cosx = Math.cos(angle);
    var sinx = Math.sin(angle);
    var negsinx = (Math.sin(angle)) * -1;

    var rotato = cosx.toString() + ‘, ‘ + sinx.toString() + ‘, ‘ + negsinx.toString() + ‘, ‘ + cosx.toString() + ‘, 0px’ + ‘, 0px’;

    $(‘#testIMG1′).css(‘-moz-transform’, ‘matrix(‘+rotato+’)');