From 9f4e23d016acef99d3eea7a1af00a87f717b0e92 Mon Sep 17 00:00:00 2001 From: windwww Date: Tue, 24 Jan 2017 21:02:30 +0800 Subject: [PATCH] Add dropify.beforeImagePreview Event Add dropify.beforeImagePreview Event, so that we can do some customised css update after image loaded --- src/js/dropify.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/js/dropify.js b/src/js/dropify.js index ebdd689..607c505 100644 --- a/src/js/dropify.js +++ b/src/js/dropify.js @@ -279,7 +279,18 @@ Dropify.prototype.setPreview = function(previewable, src) if (this.settings.height) { imgTag.css("max-height", this.settings.height); } +// add dropify.beforeImagePreview Event + var self = this; + imgTag.load(function(){ + var eventBefore = $.Event("dropify.beforeImagePreview"); + self.input.trigger(eventBefore, [self]); + }); + + if (this.settings.height) { + imgTag.css("max-height", this.settings.height); + } + imgTag.appendTo(render); } else { $('').attr('class', 'dropify-font-file').appendTo(render);