Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

HTML Drag and Drop – determine position within object

I am trying to determine the position within a div where the drop occurs (relative to the center point).
The goal would be to determine if the drop is above, below, right or left. So far, I can only find the coordinates of the event (SyntheticBaseEvent) clientX/Y, but not the coordinates of the target being dropped on.
Is there a way to determine this?

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

You can by getting the coordinates of the div and working from there

element.getBoundingClientRect();

Hope it helped

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading