mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-06 22:29:44 +08:00
59 lines
1.5 KiB
JavaScript
59 lines
1.5 KiB
JavaScript
(function(ionic) {
|
|
'use strict';
|
|
|
|
ionic.views.SideMenu = ionic.views.View.inherit({
|
|
initialize: function(opts) {
|
|
this.el = opts.el;
|
|
this.width = opts.width;
|
|
this.isEnabled = opts.isEnabled || true;
|
|
},
|
|
|
|
getFullWidth: function() {
|
|
return this.width;
|
|
},
|
|
setIsEnabled: function(isEnabled) {
|
|
this.isEnabled = isEnabled;
|
|
},
|
|
bringUp: function() {
|
|
this.el.style.zIndex = 0;
|
|
},
|
|
pushDown: function() {
|
|
this.el.style.zIndex = -1;
|
|
}
|
|
});
|
|
|
|
ionic.views.SideMenuContent = ionic.views.View.inherit({
|
|
initialize: function(opts) {
|
|
var _this = this;
|
|
|
|
ionic.extend(this, {
|
|
animationClass: 'menu-animated',
|
|
onDrag: function(e) {},
|
|
onEndDrag: function(e) {},
|
|
}, opts);
|
|
|
|
ionic.onGesture('drag', ionic.proxy(this._onDrag, this), this.el);
|
|
ionic.onGesture('release', ionic.proxy(this._onEndDrag, this), this.el);
|
|
},
|
|
_onDrag: function(e) {
|
|
this.onDrag && this.onDrag(e);
|
|
},
|
|
_onEndDrag: function(e) {
|
|
this.onEndDrag && this.onEndDrag(e);
|
|
},
|
|
disableAnimation: function() {
|
|
this.el.classList.remove(this.animationClass);
|
|
},
|
|
enableAnimation: function() {
|
|
this.el.classList.add(this.animationClass);
|
|
},
|
|
getTranslateX: function() {
|
|
return parseFloat(this.el.style.webkitTransform.replace('translate3d(', '').split(',')[0]);
|
|
},
|
|
setTranslateX: function(x) {
|
|
this.el.style.webkitTransform = 'translate3d(' + x + 'px, 0, 0)';
|
|
}
|
|
});
|
|
|
|
})(ionic);
|