-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added dajax wrapper and loading indicators
- Loading branch information
Showing
7 changed files
with
142 additions
and
32 deletions.
There are no files selected for viewing
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
* Ajax overlay 1.0 | ||
* Author: Simon Ilett @ aplusdesign.com.au | ||
* Descrip: Creates and inserts an ajax loader for ajax calls / timed events | ||
* Date: 03/08/2011 | ||
*/ | ||
function ajaxLoader(el, options) { | ||
// Becomes this.options | ||
var defaults = { | ||
bgColor: '#ffffff', | ||
duration: 100, | ||
opacity: 0.7, | ||
classOveride: false | ||
} | ||
this.options = jQuery.extend(defaults, options); | ||
this.container = $(el); | ||
|
||
this.init = function () { | ||
var container = this.container; | ||
// Delete any other loaders | ||
this.remove(); | ||
// Create the overlay | ||
var overlay = $('<div></div>').css({ | ||
'background-color': this.options.bgColor, | ||
'opacity': this.options.opacity, | ||
'width': container.width(), | ||
'height': container.height(), | ||
'position': 'absolute', | ||
'top': '0px', | ||
'left': '0px', | ||
'z-index': 1029 //bootstrap navi index is 1030 | ||
}).addClass('ajax_overlay'); | ||
// add an overiding class name to set new loader style | ||
if (this.options.classOveride) { | ||
overlay.addClass(this.options.classOveride); | ||
} | ||
// insert overlay and loader into DOM | ||
container.append( | ||
overlay.append( | ||
$('<div></div>').addClass('ajax_loader') | ||
).fadeIn(this.options.duration) | ||
); | ||
}; | ||
|
||
this.remove = function () { | ||
var overlay = this.container.children(".ajax_overlay"); | ||
if (overlay.length) { | ||
overlay.fadeOut(this.options.classOveride, function () { | ||
overlay.remove(); | ||
}); | ||
} | ||
} | ||
|
||
this.init(); | ||
} | ||
|
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
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
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