Reputation: 1426
I am wondering if there is a way to get the "absolute position" of an element that is relatively positioned. I can't think of any, but maybe someone figured out a method...
Upvotes: 1
Views: 81
Reputation: 1426
Here is a possible solution, but it might require a great deal of work to implement.
We know that internally, the rendering engine of any browser knows exactly where each element is positioned. If just the positioning code could be extracted and made into a plugin, we could then know the screen bounds (absolute position) of every relatively positioned element. Perhaps something similar to html2canvas...
Upvotes: 0
Reputation: 8581
Sounds like this question needs more details.
They should technically both have the same xy position, the only difference is that the relatively-positioned element should have a "footprint" of wherever it was moved from, and the absolutely-positioned element shouldn't leave any "footprint".
Upvotes: 0
Reputation: 48
I'm not sure what you mean by "absolute position," but you can get the client coordinates of an element with el.getBoundingClientRect()
Upvotes: 1