Make tabs auto-close on mobile
This commit is contained in:
parent
765492e882
commit
48a8a8e65c
1 changed files with 9 additions and 1 deletions
|
@ -243,7 +243,7 @@ angular.module("core-ui", [])
|
||||||
transclude: true,
|
transclude: true,
|
||||||
restrict: 'C',
|
restrict: 'C',
|
||||||
scope: {},
|
scope: {},
|
||||||
controller: function($rootScope, $scope, $element) {
|
controller: function($rootScope, $scope, $element, $timeout) {
|
||||||
$scope.isClosed = true;
|
$scope.isClosed = true;
|
||||||
|
|
||||||
$scope.toggleClosed = function(e) {
|
$scope.toggleClosed = function(e) {
|
||||||
|
@ -251,6 +251,14 @@ angular.module("core-ui", [])
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Add a listener to auto-close the tabs when a new tab is clicked.
|
||||||
|
$timeout(function() {
|
||||||
|
var tabs = $element.find('a[data-toggle="tab"]');
|
||||||
|
tabs.on('shown.bs.tab', function (e) {
|
||||||
|
$scope.isClosed = true;
|
||||||
|
});
|
||||||
|
}, 100);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
return directiveDefinitionObject;
|
return directiveDefinitionObject;
|
||||||
|
|
Reference in a new issue