mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
fix(backButton): add .header-item class
Add the .header-item class to each of the root child items of a nav header bar. This gives CSS more power to state what should and should not be shown during the different states of a transition, specifically for iOS nav bar transitions.
This commit is contained in:
7
js/angular/controller/headerBarController.js
vendored
7
js/angular/controller/headerBarController.js
vendored
@@ -22,7 +22,7 @@ function($scope, $element, $attrs, $q, $ionicConfig, $ionicHistory) {
|
||||
var titleRight = 0;
|
||||
var titleCss = '';
|
||||
var isBackEnabled = false;
|
||||
var isBackShown = false;
|
||||
var isBackShown = true;
|
||||
var titleTextWidth = 0;
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ function($scope, $element, $attrs, $q, $ionicConfig, $ionicHistory) {
|
||||
// to the navigation and history
|
||||
if (arguments.length && shouldEnable !== isBackEnabled) {
|
||||
var backBtnEle = getEle(BACK_BUTTON);
|
||||
backBtnEle && backBtnEle.classList[ shouldEnable ? 'remove' : 'add' ](HIDE);
|
||||
backBtnEle && backBtnEle.classList[ shouldEnable ? 'remove' : 'add' ]('back-disabled');
|
||||
isBackEnabled = shouldEnable;
|
||||
}
|
||||
return isBackEnabled;
|
||||
@@ -58,7 +58,7 @@ function($scope, $element, $attrs, $q, $ionicConfig, $ionicHistory) {
|
||||
// visually hidden if false, even if the history says it should show
|
||||
if (arguments.length && shouldShow !== isBackShown) {
|
||||
var backBtnEle = getEle(BACK_BUTTON);
|
||||
if (backBtnEle) backBtnEle.style.display = (shouldShow ? '' : 'none');
|
||||
backBtnEle && backBtnEle.classList[ shouldShow ? 'remove' : 'add' ](HIDE);
|
||||
isBackShown = shouldShow;
|
||||
}
|
||||
return isBackShown;
|
||||
@@ -122,7 +122,6 @@ function($scope, $element, $attrs, $q, $ionicConfig, $ionicHistory) {
|
||||
defaultTitleEle.classList.remove(HIDE);
|
||||
}
|
||||
}
|
||||
self.showBack(true);
|
||||
};
|
||||
|
||||
|
||||
|
||||
5
js/angular/controller/navBarController.js
vendored
5
js/angular/controller/navBarController.js
vendored
@@ -69,6 +69,11 @@ function($scope, $element, $attrs, $compile, $timeout, $ionicNavBarDelegate, $io
|
||||
positionButtons(navEle[buttonType], buttonType);
|
||||
});
|
||||
|
||||
// add header-item to the root children
|
||||
for (var x = 0; x < headerBarEle[0].children.length; x++) {
|
||||
headerBarEle[0].children[x].classList.add('header-item');
|
||||
}
|
||||
|
||||
// compile header and append to the DOM
|
||||
containerEle.append(headerBarEle);
|
||||
$element.append($compile(containerEle)($scope.$new()));
|
||||
|
||||
Reference in New Issue
Block a user