我目前正在使用这种方法,它允许我在div (基于边界)中拖放div/img。
<script>
$(function() {
$("#video").draggable({ containment: "#container2", scroll: false });
$("#umbrella").draggable({ containment: "#container2", scroll: false });
$("#plane").draggable({ containment: "#container2", scroll: false });
$("#peace").draggable({ containment: "#container2", scroll: false });
$("#thought").draggable({ containment: "#container2", scroll: false });
$("#thought2").draggable({ containment: "#container2", scroll: false });
$("#beachball").draggable({ containment: "#container2", scroll: false });
});
</script>我正尝试将DIV的拖放操作保存到parimiter div中的确切位置,并将其发送到MYSQL表中,该表将告诉浏览器将来(或保存后)应将其放置在何处
我只是不确定如何通过JS或JQUERY获得确切的坐标
任何帮助都将不胜感激!
提前谢谢你
安德鲁
发布于 2012-04-04 01:34:45
试试这个:
$( "#video" ).draggable({
stop : function () {
alert("X=" + $(this).position().left + ", Y=" + $(this).position().top);
}
});演示:http://jsfiddle.net/codef0rmer/FXwME/
更多信息可在此处找到:http://jqueryui.com/demos/draggable/#event-stop
https://stackoverflow.com/questions/9998333
复制相似问题