Tuesday, June 4, 2024
 Popular · Latest · Hot · Upcoming
70
rated 0 times [  73] [ 3]  / answers: 1 / hits: 19574  / 9 Years ago, wed, august 5, 2015, 12:00:00

I want to change the generic greyed out background for word/pdf files in dropzone file preview. This is the default view:



enter



Which is the best way to do it?


More From » css

 Answers
25

This is the way I did it finally:



myAwesomeDropzone.on('addedfile', function(file) {

var ext = file.name.split('.').pop();

if (ext == pdf) {
$(file.previewElement).find(.dz-image img).attr(src, /Content/Images/pdf.png);
} else if (ext.indexOf(doc) != -1) {
$(file.previewElement).find(.dz-image img).attr(src, /Content/Images/word.png);
} else if (ext.indexOf(xls) != -1) {
$(file.previewElement).find(.dz-image img).attr(src, /Content/Images/excel.png);
}
});


The images must be 120x120 pixels to fit the default preview template.



This is the result:



enter


[#65528] Monday, August 3, 2015, 9 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
levidaylonj

Total Points: 392
Total Questions: 100
Total Answers: 112

Location: Bahrain
Member since Fri, Sep 16, 2022
2 Years ago
;