Jquery可拖动持久性是通过mysql还是在数据库中保存cookie?
我想知道如何保留放置在可拖动对象上的 div。我长期以来一直在尝试,但停留在这一点上。实际上你可以在这里看到演示。我必须保存用户设计的婚礼地板。因此,每当用户下次登录时,他/她就能够看到上次保存的设计。代码如下所示:
$(document).ready(function() {
$("#droppable").droppable({
accept: '.draggable',
drop: function(event, ui) {
$(this).append($(ui.draggable).clone());
$("#droppable .draggable").addClass("objects");
$(".objects").removeClass("ui-draggable draggable");
$(".objects").draggable({
containment: 'parent',
});
}
});
$(".draggable").draggable({
helper: 'clone',
tolerance: 'touch',
cursor:'move'
});
});
I want to know that how can I persist the divs dropped on a draggable. I have been trying since long but stuck at this point. Actually you can see the demo here. I have to save the user designed wedding floor. So whenever user logins next time he/ she is able to see the last design saved. The code is shown below:
$(document).ready(function() {
$("#droppable").droppable({
accept: '.draggable',
drop: function(event, ui) {
$(this).append($(ui.draggable).clone());
$("#droppable .draggable").addClass("objects");
$(".objects").removeClass("ui-draggable draggable");
$(".objects").draggable({
containment: 'parent',
});
}
});
$(".draggable").draggable({
helper: 'clone',
tolerance: 'touch',
cursor:'move'
});
});
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我已经问过此类问题,请阅读以下内容:
jQuery UI 可排序:确定项目的顺序
以及:
在拖/放元素时获取列表中元素的位置 (ui.sortable)
希望这有帮助
I have already asked to this kind of question read this:
jQuery UI sortable: determining in what order the items are
and this:
Getting the position of the element in a list when it's drag/dropped (ui.sortable)
hope this help
这里有一个很好的教程和演示,介绍如何使用 PHP、jQuery-UI 和 MySQL 进行拖放:PaperMashup
There's a nice tutorial and demo of how to drag-and-drop with PHP,jQuery-UI and MySQL here: PaperMashup