Changes between Initial Version and Version 1 of Ticket #6259, comment 11


Ignore:
Timestamp:
Mar 5, 2019, 12:48:59 AM (3 years ago)
Author:
Ryan J Ollos
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #6259, comment 11

    initial v1  
    22> Hello, the solution is simple. The drop can't be effective if you don't release the left mouse, so just detect the state of it, and bloc any action in droppable if you don't have left mouse released :
    33>
    4 >
    5 > var leftButtonDown;
    6 > $(document).mousedown(function(e){
    7 >    if(e.which === 1) leftButtonDown = true;
    8 > });
    9 > $(document).mouseup(function(e){
    10 >    if(e.which === 1) leftButtonDown = false;
    11 > });
    12 >
    13 > .droppable({
    14 >   drop:function(e,ui){
    15 >
    16 >     if(leftButtonDown) return false;
    17 >     // Here code when really drop
    18 >
    19 > });
    20 
     4> ...
    215
    226This work-around works perfectly for FF & Chrome but IE10 triggers drop event first and then mouseup will get fire. So again this will not work on IE10.