How do I detect a file is being dragged rather than a draggable element on my page?

后端 未结 4 1691
没有蜡笔的小新
没有蜡笔的小新 2020-12-29 01:30

I\'m using the html5 events to enable both file and element drag-and-drop. I\'ve attached the dragover event to the body and am using event delegations to show where a dragg

4条回答
  •  我在风中等你
    2020-12-29 02:24

    I just use this to detect files in dragover event:

    Array.prototype.indexOf.call(files, "Files")!=-1 // true if files
    

提交回复
热议问题