I need to know where the user drops the element. How do I echo both the .left and .top position on drop?
<div id="Draggable" style="position: fixed;">
<img src="images/door1.jpg" id="door">
</div>
<script type="text/javascript">
$( init );
function init() {
$('#Draggable').draggable();
$('body').droppable( {
drop: function(event, ui){
// ECHO POSITION
}
} );
}
</script>
Use
ui.positionwhich will gives{ top, left }relative to the offset element. inside drop callback.ui.offsetis also there which again gives the same{ top, left }relative to the page.