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

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -