开发者

Draggable nested inside Draggable drags both when dragging child in IE

开发者 https://www.devze.com 2022-12-19 02:23 出处:网络
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

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>
  开发者_Python百科<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>

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?

Thanks, ~Matt


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.

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.

Thanks, ~Matt

0

精彩评论

暂无评论...
验证码 换一张
取 消