How to detect the dragleave event in Firefox when dragging outside the window

后端 未结 5 1665
借酒劲吻你
借酒劲吻你 2020-12-04 10:31

Firefox doesn\'t properly trigger the dragleave event when dragging outside of the window:

https://bugzilla.mozilla.org/show_bug.cgi?id=665704

https://bugzil

5条回答
  •  春和景丽
    2020-12-04 11:15

    Depending on what you wish to accomplish you can get around this issue by using the :-moz-drag-over pseudo-class that is only available in Firefox which lets you react to a file being dragged over an element.

    Take a look at this simple demo http://codepen.io/ryanseddon/pen/Ccsua

    .dragover {
        background: red;
        width: 500px;
        height: 300px;
    }
    .dragover:-moz-drag-over {
        background: green;
    }
    

提交回复
热议问题