2012-01-18 52 views
0

如果我使用這個功能使用jQuery UI的拖動,使元素可拖動:如何訪問一個元素的座標,因爲它是被拖到

$(document).ready(function() { 
    $("#draggableSquare").draggable(); 
}); 

我如何可以訪問的的座標元素移動了嗎?

+0

似乎aswer在這裏http://stackoverflow.com/questions/849030/how-do-i-get-the-coordinate-position-after-using-jquery-drag -and降 – firegnom 2012-01-18 18:29:14

回答

0
$("#draggable").draggable({ 
    drag: function(event,ui) { 
     //relative to container: ui.position.left and ui.position.top 
     //ralative to page: ui.offset.left and ui.offset.top 
    } 
}); 

jsFiddle

相關問題