HTML5 dragend event firing immediately

前端 未结 3 1941
深忆病人
深忆病人 2021-01-04 05:38

I have several draggable elements

Box 1: Milk was a bad choice.
相关标签:
3条回答
  • 2021-01-04 06:17

    This is a known chrome issue. Problem is, as Joerg mentions that you manipulates the dom on dragstart.

    You can do so, but you need to do it in a timeout.

    0 讨论(0)
  • 2021-01-04 06:33

    As i mentioned in the topic dragend, dragenter, and dragleave firing off immediately when I drag , what solved the problem (which looks to be a Chrome bug) for me was to add a setTimeout of 10 milliseconds into the handler and manipulate the DOM in that timeout.

    0 讨论(0)
  • 2021-01-04 06:42

    I don't have a direct solution, but changing the DOM in the dragStart event handler is causing this problem, and any code that changes the DOM should really go in the dragEnter event handler - doing so, drag&drop events are fired more reliably.

    Not sure whether this is by design - it feels a bit like a bug though.

    0 讨论(0)
提交回复
热议问题