Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[js] 第124天 如何实现文件拖动上传? #1080

Open
haizhilin2013 opened this issue Aug 17, 2019 · 2 comments
Open

[js] 第124天 如何实现文件拖动上传? #1080

haizhilin2013 opened this issue Aug 17, 2019 · 2 comments
Labels
js JavaScript

Comments

@haizhilin2013
Copy link
Collaborator

第124天 如何实现文件拖动上传?

@haizhilin2013 haizhilin2013 added the js JavaScript label Aug 17, 2019
@Konata9
Copy link

Konata9 commented Aug 19, 2019

利用 HTML5 的 drag & drop API 来实现。需要注意的是,必须要设置 dragover 事件,不然不会触发 drop 事件。

示例:https://codepen.io/Konata9/pen/BaBzExe?editors=1011

@xiaoqiangz
Copy link

xiaoqiangz commented Jul 8, 2022

可以利用拖放事件,drag、dragover、dragenter、drop 来实现,再利用dataTransfer对象来实现数据交换。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
js JavaScript
Projects
None yet
Development

No branches or pull requests

3 participants