简体   繁体   中英

get width of transformed: scaled element

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM