在IE中拖动子项时,Draggable嵌套在Draggable中拖动 [英] Draggable nested inside Draggable drags both when dragging child in IE

查看:104
本文介绍了在IE中拖动子项时,Draggable嵌套在Draggable中拖动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用jQuery构建一个座位应用程序。我的桌子周围有椅子,可能有客人坐在椅子上。每个表都有一个可拖动的包装div。桌子内有任意数量的椅子。客人可以坐在任何椅子上。客人也是一个嵌入椅子div的div。以下是一个此类表的标记示例。这张桌子有8个chiars,两个客人坐在前两把椅子上。

I'm building a seating application using jQuery. I have tables with chairs around them, which may have guests seated at the chairs. Each table has a wrapper div which is draggable. Inside the table are any number of chair div's. Inside any chair div a guest may be seated. Guest are also a div which is nested inside the chair div. Here is a sample for the markup of one such table. This table has 8 chiars with two guests seated at the first two chairs.

<div id="table-wrapper-1" class="table-wrapper table-type-0 ui-draggable">  
  <div id="table-1" class="seating-table">    
    <div class="seating-table-name">Table 1</div>  
  </div>
  <div id="chair-1-0" class="chair chair-pos-0 table-chair-1">
    <div title="Elaine Benis" id="guest-2-5-2" class="guest guest-2 ui-draggable"></div>
  </div>
  <div id="chair-1-1" class="chair chair-pos-1 table-chair-1">
    <div title="Elaine Benis" id="guest-2-5-2" class="guest guest-2 ui-draggable"></div>
  </div>
  <div id="chair-1-2" class="chair chair-pos-2 table-chair-1"></div>
  <div id="chair-1-3" class="chair chair-pos-3 table-chair-1"></div>
  <div id="chair-1-4" class="chair chair-pos-4 table-chair-1"></div>
  <div id="chair-1-5" class="chair chair-pos-5 table-chair-1"></div>
  <div id="chair-1-6" class="chair chair-pos-6 table-chair-1"></div>
  <div id="chair-1-7" class="chair chair-pos-7 table-chair-1"></div>
</div>

div.table-wrapper是可拖动的,div.guest也是如此。我们的想法是您可以将访客从一个椅子拖到另一个椅子,或将整个表拖到另一个位置。我遇到的问题是在IE中,如果您单击并拖动访客,则客户和表同时拖动。有谁知道我怎么解决这个问题?

The div.table-wrapper is a draggable and so are the div.guest's. The idea is that you can drag a guest from one chair to another, or drag the entire table to a different location. The problem I am having is in IE, where if you click and drag a guest, both the guest and the table drag at the same time. Does anyone know how I can fix that?

谢谢,
~Matt

Thanks, ~Matt

推荐答案

经过大量挖掘,我现在似乎找到了解决方案。它涉及黑客ui.draggable.js,但目前它看起来没有任何其他方式。

After a lot of digging, I seem to have found a solution for now. It involves hacking ui.draggable.js, but currently it doesn't look like there is any other way.

要查看我的完整答案,请查看我的帖子在jQuery论坛上:

To see my full answer, have a look at my post on the jQuery forum:

http://forum.jquery.com/topic/draggable-nested-inside-draggable-drags-both-when-dragging-child-in-ie

希望这可以帮助有类似问题的人。

Hope this helps someone with a similar issue.

谢谢,
~Matt

Thanks, ~Matt

这篇关于在IE中拖动子项时,Draggable嵌套在Draggable中拖动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆