Skip to content

Commit

Permalink
Display spinning icon when plugin loads
Browse files Browse the repository at this point in the history
  • Loading branch information
kartik-v committed Jun 13, 2014
1 parent be8c5cb commit 8f00c81
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 9 deletions.
11 changes: 11 additions & 0 deletions css/fileinput.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,17 @@
* Year: 2013
* For more Yii related demos visit http://demos.krajee.com
*/
.file-loading {
top: 0;
right: 0;
width: 25px;
height: 25px;
font-size: 999px;
text-align: right;
color: #fff;
background: transparent url('../img/loading.gif') top left no-repeat;
border: none;
}
.btn-file {
position: relative;
overflow: hidden;
Expand Down
6 changes: 3 additions & 3 deletions css/fileinput.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added img/loading.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 9 additions & 5 deletions js/fileinput.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@
hiddenVal: self.$hidden.val()
};
this.options = options;
self.$element.removeClass('file-loading');
},
listen: function () {
var self = this;
Expand Down Expand Up @@ -415,16 +416,19 @@
elPreviewStatus: null
};

var $input = $('input.file[type=file]'), count = Object.keys($input).length;

if (count > 0) {
$input.addClass('file-loading');
}
/**
* Convert automatically file inputs with class 'file'
* into a bootstrap fileinput control.
*/
$(function () {
var $element = $('input.file[type=file]');
if ($element.length > 0) {
$element.fileinput();
$(document).ready(function () {
if (count > 0) {
$input.fileinput();
}

});

})(window.jQuery);
Loading

0 comments on commit 8f00c81

Please sign in to comment.