【问题标题】:Jquery ui draggable cannot de dropped in elements defined at 'appendTo'?Jquery ui draggable 不能在'appendTo' 定义的元素中删除?
【发布时间】:2011-08-01 18:00:21
【问题描述】:

我在容器中有一些图像,它们都是可拖动的,下面有一些带有“容器”类的可放置容器。

draggable 已将“snap”定义为“.container”。

问题是,如果它“捕捉”到容器中,可拖动对象永远不会掉落,如果我删除“捕捉”属性,问题就解决了,但我真的很想在它们掉落之前捕捉可拖动对象

左边的图片不掉(被抓拍了),右边的图片掉了。

我会很感激任何想法

代码:

--draggable
$('#' + this.Id + ' .imageList li img').draggable({ scroll: true, helper: 'clone', revert: 'invalid', snap: '.dropHere, .dropHereReassign', appendTo: 'body', revertDuration: 200, snapMode: 'inner');

--droppable
var that = this;
$('#' + this.Id + ' .imageList img.dropHere').droppable({ drop: function (event, ui) {
$(that).attr('src', ui.draggable.attr('src'));
$(that).removeClass('dropHereReassign');
$(that).droppable({ disabled: true }); } });

HTML:

<div id="imagesContainer">
 <ul class="imageList">
  <li><img id="photo-1" src="/someImage.jpg" /></li>
 </ul>
</div>
<div id="dropImagesContainer" class="photoSection">
 <ul class="imageList">
  <li><img src="/00/06/12/00061275_in.png"><span class="description"></span></li>
  <li><img src="/dropHere.jpg"><span class="description"></span></li>
 </ul>
</div>

【问题讨论】:

  • 你能提供你的代码吗?
  • 完成,如果左上角不在容器内,它似乎不会下降(即使在边界内)
  • 你能提供你的 HTML 吗?

标签: jquery jquery-ui-draggable jquery-ui-droppable


【解决方案1】:

您是否尝试过添加属性?

            connectToSortable: ".imageList",

这里有一些很好的例子:http://jqueryui.com/demos/draggable/#sortable

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-07-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-09-11
    • 2014-03-04
    相关资源
    最近更新 更多