Drop event not firing in chrome

后端 未结 4 1630
生来不讨喜
生来不讨喜 2020-12-02 18:02

It seems the drop event is not triggering when I would expect.

I assume that the drop event fires when an element that is being dragged is releases above the target

4条回答
  •  醉梦人生
    2020-12-02 18:37

    This isn't an actual answer but for some people like me who lack the discipline for consistency. Drop didn't fire for me in chrome when the effectAllowed wasnt the effect I had set for dropEffect. It did however work for me in Safari. This should be set like below:

    ev.dataTransfer.effectAllowed = 'move';

    Alternatively, effectAllowed can be set as all, but I would prefer to keep specificity where I can.

    for a case when drop effect is move:

    ev.dataTransfer.dropEffect = 'move';

提交回复
热议问题