Skip to content

Instantly share code, notes, and snippets.

@alexermakov
Last active August 6, 2016 14:06
Show Gist options
  • Select an option

  • Save alexermakov/7e9c81dd8fa86ab986b2967e73e8f787 to your computer and use it in GitHub Desktop.

Select an option

Save alexermakov/7e9c81dd8fa86ab986b2967e73e8f787 to your computer and use it in GitHub Desktop.
Ширина и высота skew элемента
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