Why doesn't HTML5 drag and drop work in Firefox?

前端 未结 5 1251
感动是毒
感动是毒 2021-02-01 02:36

I have bound events to different elements, and when I drag them in all browsers, except Firefox, it works as expected. In firefox, however, it doesn\'t work at all. The only eve

5条回答
  •  终归单人心
    2021-02-01 02:52

    You can use this as a reference for this question solution regarding the redirects that occur on Firefox.

    You need to prevent the default action in drop method to fix this issue.

    function drop(e) {
        if(e.preventDefault) { e.preventDefault(); }
        if(e.stopPropagation) { e.stopPropagation(); }
    
        //your code here
    
        return false;
    }
    

    I got this solution from this link.

提交回复
热议问题