javascript - Detecting drag position on an element -


i building wysiwyg editor build html emails. want able add row layouts editor drag , drop.

if row dragged , dropped above halfway point of drop target, want prepend row before drop target; , if dropped below halfway point, want append row after drop target.

is there way this?

you can use getboundingclientrect() coordinates of element while mouse button pressed , moving this

element.onclick = function() {     element.onmousemove = function() {         var x1 = element.getboundingclientrect().left,             x2 = x1 + element.getboundingclientrect().width,             y1 = element.getboundingclientrect().top,             y2 = element.getboundingclientrect().height;     } } 

and can whatever these coordinates.


Comments

Popular posts from this blog

java - HTTP Status 500 - An exception occurred processing JSP page /second.jsp at line 15 -

SQL Server - MyCTE query based on 24 hour period (next day) -

php - Using str_replace to translate a MySQL Table in html -