Created
February 6, 2013 23:37
-
-
Save enyo/4726916 to your computer and use it in GitHub Desktop.
Tweek dropzone to use another container for file previews
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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>")); | |
} | |
}; |
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.
Thanks, this really helped me with a dropzone that was driving me nuts.
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.
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
nice! I don't know how but Google brought me here..