1

I have two listeners. One is the droppable class from jquery UI

$("#myDiv").droppable({
    drop: function( event, ui ) {
         console.log('I happened');
         if (window.draggingMove == true) {
              alert('I want to get here but I never make it');
         }
    }
});

I also have a higher up listener that clears things universally.

$(document).on('mouseup', function(event) {
    window.draggingMove = false;
    console.log('all dragging is cleared');
});

However, when I complete the "drop" action and they both trigger, yet the second one triggers first, so i see this in my console.

  "all dragging is cleared"
  "I happened"

It was my understanding that droppable should trigger first since its attached to myDiv. How can I get that to happen before document listener?

Any ideas?

4

1 回答 1

0

我认为,$(document) 是通用的,所以它会在每个 mouseup 事件中发生,而不仅仅是 drop。如果在 drop 发生之前发生了 mouseup 事件,则应首先调用它。

于 2012-02-24T19:33:02.347 回答