多个块移动时拖动恢复出现问题

发布于 11-25 11:41 字数 579 浏览 1 评论 0原文

在以下链接中: http://probl.frizi.net/ 我正在尝试设置可变大小和位置块。彩色块需要留在灰色大块内。无论如何,我试图将彩色块保留在内部,它们往往(在第二次运动时)变形或在开始时处于不同的位置。恢复方法无法正常工作,或者我没有正确实现它。

到目前为止,我正在尝试执行以下操作(请右键单击并查看页面上的 Jquery 源代码):

var item;
$( "#droppable" ).droppable({
out: function(event, ui) { 
    $(item).draggable({ revert: true });
    var revert = $(item).draggable( "option", "revert" );
    $(item).draggable( "option", "revert", true );
    }
}); 

$(".blk").draggable({
    start: function(event, ui) { 
    item = $(this);
}
});

At the following link : http://probl.frizi.net/ i'm trying to set variable size and position blocks. The colored blocks need to stay within the gray big block. Anyhow I'm trying to keep the colored blocks inside, they tend (at second movement) to deform or to go on a different possition as they started. Revert method is not working as it should or I didn't implemented it correctly.

Till far, I'm trying to do the following (please rightclick and see the Jquery source on the page):

var item;
$( "#droppable" ).droppable({
out: function(event, ui) { 
    $(item).draggable({ revert: true });
    var revert = $(item).draggable( "option", "revert" );
    $(item).draggable( "option", "revert", true );
    }
}); 

$(".blk").draggable({
    start: function(event, ui) { 
    item = $(this);
}
});

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文