keep the spinner visible while the image loads
This commit is contained in:
parent
0206a6f94c
commit
1b31c5fc90
@ -54,6 +54,10 @@ $.fn.imageUpload = function() {
|
|||||||
contentType: 'application/octet-stream',
|
contentType: 'application/octet-stream',
|
||||||
}).done(function(data){
|
}).done(function(data){
|
||||||
$input.val(data.file);
|
$input.val(data.file);
|
||||||
|
$img.one('load', function() {
|
||||||
|
$uploadButton.prop('disabled', false);
|
||||||
|
$spinner.remove();
|
||||||
|
});
|
||||||
$img.prop('src', '../imageupload?file=' + data.file);
|
$img.prop('src', '../imageupload?file=' + data.file);
|
||||||
clearError();
|
clearError();
|
||||||
}).fail(function(xhr, error){
|
}).fail(function(xhr, error){
|
||||||
@ -63,7 +67,6 @@ $.fn.imageUpload = function() {
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
handleError(error);
|
handleError(error);
|
||||||
}
|
}
|
||||||
}).always(function(){
|
|
||||||
$uploadButton.prop('disabled', false);
|
$uploadButton.prop('disabled', false);
|
||||||
$spinner.remove();
|
$spinner.remove();
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user