get width of transformed: scaled element

324 Views Asked by At

I have 2 elemenets. One is scaled down in the CSS

.firstElement{
-webkit-transform:scale(.5,.5);
}

and the other is scaled inline by jQuery's

secondElement.animate({scale:.2, origin:[0,0])}

I need to get the width and height of the secondElement and the firstElement in pixels after they are scaled down. I tried everything, Im really not sure why I cant get this. Anyone have any ideas? Thanks

1

There are 1 best solutions below

0
On
var matrix = window.getComputedStyle(this).webkitTransform,
        data;
    if (matrix != 'none') {
        data = matrix.split('(')[1].split(')')[0].split(',');
    } else {
        data = [1,null,null,1];
    }

Code Courtesy : CSS TRICKS

FIDDLE DEMO