Imagine that I have a popup that is centered with transform:translateX(-50%) translateY(-50%)
(if you have questions about this solution, you can see more about it here , adapted from these Answers ).
So far so good, the element is centralized correctly, but let's say for some reason I need to figure out the exact position of it in document
of the browser (to implement a drag-and-drop by example). I tried the properties offsetTop
and offsetLeft
but they return the position of the element without the transforms, ie it is a "fake" position.
My question is, is there any property that returns the actual values of an element that is positioned using translate
?
Here is an example for a better understanding: FIDDLE
.