Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dropzone.js fade on removeFile()

I'm using dropzone.js and my "remove when it's finished" code looks like this:

Dropzone.options.myAwesomeDropzone = {
     init: function () {
        this.on("success", function (file) {
           this.removeFile(file);
        });
     }
};

It works as expected, but the section is removed instantly. What I'd like is for that to take a second and fade out so that the user can actually see that the image completed before it's gone. How can I add some kind of transition to removeFile?

like image 203
Citizen Avatar asked Feb 12 '23 00:02

Citizen


1 Answers

With jQuery, should be something like this...

Dropzone.options.myAwesomeDropzone = {
  init: function () {
    this.on("success", function (file) {
      var _this = this;
      $(file.previewElement).fadeOut({
        complete: function() {
          // If you want to keep track internally...
          _this.removeFile(file);
        }
      });
    });
  }
};
like image 128
gwing33 Avatar answered Feb 13 '23 16:02

gwing33