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,
|
||||
restrict: 'C',
|
||||
scope: {},
|
||||
controller: function($rootScope, $scope, $element) {
|
||||
controller: function($rootScope, $scope, $element, $timeout) {
|
||||
$scope.isClosed = true;
|
||||
|
||||
$scope.toggleClosed = function(e) {
|
||||
|
@ -251,6 +251,14 @@ angular.module("core-ui", [])
|
|||
e.stopPropagation();
|
||||
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;
|
||||
|
|
Reference in a new issue