Last active
March 8, 2017 00:23
-
-
Save jackrugile/0a1dbfa05a9c26fd9d82f45156da4e6f to your computer and use it in GitHub Desktop.
Normalize center transform-origin cross-browser issue
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 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