Last active
August 6, 2016 14:06
-
-
Save alexermakov/7e9c81dd8fa86ab986b2967e73e8f787 to your computer and use it in GitHub Desktop.
Ширина и высота skew элемента
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function getBoundingBox(element){ | |
| // Get the transformation matrix as a string | |
| var tm = element.css('transform'); | |
| // Transform the string to an array | |
| var regexp = /-?\d+[\.\d]*/g; | |
| tm = tm.match(regexp); | |
| // Get the size of the object and calculate the bounding box | |
| var h = element.height(); | |
| var w = element.width(); | |
| var th = Math.abs(h * tm[0]) + Math.abs(w * tm[1]); | |
| var tw = Math.abs(h * tm[2]) + Math.abs(w * tm[3]); | |
| return {'height':th,'width':tw} | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment