Skip to content

Instantly share code, notes, and snippets.

@enyo
Created Feb 6, 2013
Embed
What would you like to do?
Tweek dropzone to use another container for file previews
Dropzone.myDropzone.options = {
addedfile: function(file) {
file.previewTemplate = $(this.options.previewTemplate);
this.element.find(".previews").append(file.previewTemplate);
file.previewTemplate.find(".filename span").text(file.name);
file.previewTemplate.find(".details").append($("<div class=\"size\">" + (this.filesize(file.size)) + "</div>"));
}
};
@Maniacsh

This comment has been minimized.

Copy link

@Maniacsh Maniacsh commented May 31, 2017

nice! I don't know how but Google brought me here..

@bcalik

This comment has been minimized.

Copy link

@bcalik bcalik commented Feb 19, 2018

You can just set it like below, so you don't have to fill the content manually.
this.previewsContainer = document.getElementById("another-container");

Edit: this won't work properly because addedFile is called AFTER the file is added. So the next file will be affected, which is not useful.

@normanfernandez

This comment has been minimized.

Copy link

@normanfernandez normanfernandez commented Jul 25, 2018

Thanks, this really helped me with a dropzone that was driving me nuts.

@eliamartani

This comment has been minimized.

Copy link

@eliamartani eliamartani commented Jul 10, 2019

You can just set it like below, so you don't have to fill the content manually.
this.previewsContainer = document.getElementById("another-container");

Edit: this won't work properly because addedFile is called AFTER the file is added. So the next file will be affected, which is not useful.

Worked for me. Thanks.

@viniciusbig

This comment has been minimized.

Copy link

@viniciusbig viniciusbig commented Aug 24, 2020

nice! I don't know how but Google brought me here..

The same for me! LOL

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment