Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

dropzone.js: checkmark and x icons show after upload

Probably a CSS issue, but when I create a dropzone box programmatically I get the checkmark and x icons as well as other text after it finishes (see linked image).

<div id="header-dropzone"></div>
$("#header-dropzone").dropzone({ url: "/header" })

If I just use the form and just build it using the dropzone initialization, it doesn't show the icons after upload.

<form action="/header" class="dropzone"></form>

enter image description here

Why does the jquery-style one not hide those icons? They're using the same css.

like image 999
voodoogiant Avatar asked Aug 21 '15 05:08

voodoogiant


2 Answers

I ran into this issue too. My solution was to add the dropzone class to the element after initializing it. This gets around the autoDiscover issue, but keeps the check/x behavior working.

Here's my code

$("#my-dropzone").dropzone({ /* options */ });
$("#my-dropzone").addClass("dropzone");
like image 58
QuickDanger Avatar answered Oct 31 '22 08:10

QuickDanger


I just filed a bug at: https://gitlab.com/meno/dropzone/issues/57

Meanwhile, a workaround is to manually fix this up, by turning the white tick green and the white-cross invisible (or vice-versa):

theDropzone.on("success", function(file){   
  $(".dz-success-mark svg").css("background", "green");
  $(".dz-error-mark").css("display", "none");
});
theDropzone.on("error", function(file) {
  $(".dz-error-mark svg").css("background", "red");
  $(".dz-success-mark").css("display", "none");
});
like image 8
Richard Avatar answered Oct 31 '22 10:10

Richard