简体   繁体   中英

dropzone.js with HTML element

Couldn't found in the documentation anything about using dropzone.js with simple HTML element. I'm using it for uploading files and I'm trying to add this functionality: when dropped an HTML element in it, I will be using the data in the html to do something (ie move already uploaded files). Tried to drag the HTML element but I notice that the "drop" event is fired multiple times. When dropping files from OS it is fired once... I can't understand why it's happening! Thank you for your suggestions.

var myDropzone = new Dropzone(target, {
  url: "./fake", // fake, must be indicated for the plugin but I do not use it
  autoProcessQueue: false,
  clickable: false,
});

myDropzone.on("drop", (ev) => {
    //do something
})

Silly me.

Forgot to use stopImmediatePropagation.

myDropzone.on("drop", (ev) => {
    ev.stopImmediatePropagation();
    //do something
})

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM