Skip to content

Instantly share code, notes, and snippets.

@jackrugile
Last active March 8, 2017 00:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jackrugile/0a1dbfa05a9c26fd9d82f45156da4e6f to your computer and use it in GitHub Desktop.
Save jackrugile/0a1dbfa05a9c26fd9d82f45156da4e6f to your computer and use it in GitHub Desktop.
Normalize center transform-origin cross-browser issue
function centerTransformOrigin(elems) {
for(let i = 0; i < elems.length; i++) {
let bcr = elems[i].getBBox();
elems[i].style.transformOrigin = `${bcr.x + bcr.width / 2}px ${bcr.y + bcr.height / 2}px`;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment