Skip to content

Commit

Permalink
fix(loading): backdrop higher z-index
Browse files Browse the repository at this point in the history
  • Loading branch information
mlynch committed May 22, 2014
1 parent 4c700e9 commit bfce8e2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
19 changes: 9 additions & 10 deletions js/angular/service/backdrop.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ function($document) {

var el = jqLite('<div class="backdrop">');
var backdropHolds = 0;
var backdropExtraClasses = null;

$document[0].body.appendChild(el[0]);

Expand All @@ -57,23 +56,20 @@ function($document) {
* Releases the backdrop.
*/
release: release,

getElement: getElement,

// exposed for testing
_element: el
};

function retain(extraClasses) {
backdropExtraClasses = extraClasses;

function retain() {
if ( (++backdropHolds) === 1 ) {
el.addClass('visible');
ionic.requestAnimationFrame(function() {
backdropHolds && el.addClass('active');
});
}
if(extraClasses) {
console.log('Adding', extraClasses);
el.addClass(extraClasses);
}
}
function release() {
if ( (--backdropHolds) === 0 ) {
Expand All @@ -82,7 +78,10 @@ function($document) {
!backdropHolds && el.removeClass('visible');
}, 100);
}
el.removeClass(backdropExtraClasses);
backdropExtraClasses = null;
}

function getElement() {
return el;
}

}]);
4 changes: 3 additions & 1 deletion js/angular/service/loading.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,8 @@ function($document, $ionicTemplateLoader, $ionicBackdrop, $timeout, $q, $log, $c
//options.showBackdrop: deprecated
this.hasBackdrop = !options.noBackdrop && options.showBackdrop !== false;
if (this.hasBackdrop) {
$ionicBackdrop.retain('backdrop-loading');
$ionicBackdrop.retain();
$ionicBackdrop.getElement().addClass('backdrop-loading');
}
}

Expand Down Expand Up @@ -176,6 +177,7 @@ function($document, $ionicTemplateLoader, $ionicBackdrop, $timeout, $q, $log, $c
if (this.isShown) {
if (this.hasBackdrop) {
$ionicBackdrop.release();
$ionicBackdrop.getElement().removeClass('backdrop-loading');
}
self.element.removeClass('active');
setTimeout(function() {
Expand Down

0 comments on commit bfce8e2

Please sign in to comment.