6
Imagine I have a popup that’s centered on transform:translateX(-50%) translateY(-50%)
(if you have doubt about this solution, you can see more about it here, adapted of these answers).
So far so good, the element is centered correctly, but let’s say for some reason I need to figure out his exact position in document
browser (to implement a drag'n-drop for example). I tried the properties offsetTop
and offsetLeft
but they return the position of the element without the Transforms, ie it is a position "fake".
My question is, is there any property that returns the values real of an element that is positioned using translate
?
Follow an example for better understanding: FIDDLE
.
Please, the code in the answer. The way it is is not considered a very valid answer.
– Don't Panic
Welcome to Stack Overflow, Rafael! I suggest you explain your solution better (a working example would be great!) and that you do not share contact details in responses - oh, and that tour to get to know Sopt better! :)
– Daniel