mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-07 06:57:02 +08:00
Angular sidebar working.
YEY!
This commit is contained in:
@ -8,16 +8,22 @@ angular.module('ionic.ui', [])
|
|||||||
SideMenuController.call(this, {
|
SideMenuController.call(this, {
|
||||||
left: {
|
left: {
|
||||||
width: 270,
|
width: 270,
|
||||||
|
isEnabled: true,
|
||||||
pushDown: function() {
|
pushDown: function() {
|
||||||
|
$scope.leftZIndex = -1;
|
||||||
},
|
},
|
||||||
bringUp: function() {
|
bringUp: function() {
|
||||||
|
$scope.leftZIndex = 0;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
right: {
|
right: {
|
||||||
width: 270,
|
width: 270,
|
||||||
|
isEnabled: true,
|
||||||
pushDown: function() {
|
pushDown: function() {
|
||||||
|
$scope.rightZIndex = -1;
|
||||||
},
|
},
|
||||||
bringUp: function() {
|
bringUp: function() {
|
||||||
|
$scope.rightZIndex = 0;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
content: {
|
content: {
|
||||||
@ -35,14 +41,16 @@ angular.module('ionic.ui', [])
|
|||||||
return $scope.contentTranslateX || 0;
|
return $scope.contentTranslateX || 0;
|
||||||
},
|
},
|
||||||
setTranslateX: function(amount) {
|
setTranslateX: function(amount) {
|
||||||
//this.el.style.webkitTransform = 'translate3d(' + amount + 'px, 0, 0)';
|
|
||||||
$scope.contentTranslateX = amount;
|
$scope.contentTranslateX = amount;
|
||||||
|
$scope.$apply();
|
||||||
},
|
},
|
||||||
enableAnimation: function() {
|
enableAnimation: function() {
|
||||||
//this.el.classList.add(this.animateClass);
|
//this.el.classList.add(this.animateClass);
|
||||||
|
$scope.animationEnabled = true;
|
||||||
},
|
},
|
||||||
disableAnimation: function() {
|
disableAnimation: function() {
|
||||||
//this.el.classList.remove(this.animateClass);
|
//this.el.classList.remove(this.animateClass);
|
||||||
|
$scope.animationEnabled = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -76,6 +84,16 @@ angular.module('ionic.ui', [])
|
|||||||
|
|
||||||
$scope.$watch('contentTranslateX', function(value) {
|
$scope.$watch('contentTranslateX', function(value) {
|
||||||
console.log('Translate X changing', value);
|
console.log('Translate X changing', value);
|
||||||
|
$element[0].style.webkitTransform = 'translate3d(' + value + 'px, 0, 0)';
|
||||||
|
});
|
||||||
|
|
||||||
|
$scope.$watch('animationEnabled', function(isAnimationEnabled) {
|
||||||
|
if(isAnimationEnabled) {
|
||||||
|
$element[0].classList.add('menu-animated');
|
||||||
|
} else {
|
||||||
|
$element[0].classList.remove('menu-animated');
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user