javascript - jQuery - Drag and drop - Get DROP left and top position -


I should know where the user leaves the element on how to drop both the .left and .top position on the drop down Can i do "draggable" style = "position: fixed;" & Gt; & Lt; Img src = "picture / door 1.jpg" id = "door" & gt; & Lt; / Div & gt; & Lt; Script type = "text / javascript" & gt; $ (Init); Function init () {$ ('# draggable'). Pullable (); $ ('Body') Droppable ({drop: function (Event, UI) {// ECHO POSITION}}); } & Lt; / Script & gt;

Use ui.position which The ui.offset inside the drop callback relative to the offset element {top, left} which is similar to the page again {top, left} returns.

  function init () {$ ('# draggable') dragable () .; $ ('Body') Droppable ({drop: function (Event, UI) {// ECO Position Alert (ui.position.top); Alert (ui.position.left);}}); }    

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

ruby on rails - Convert a Activerecord result with has_one associations into a single hash per record -

c# - Confused over DLL entry points (entry point not found exception) -