meteor-ionic/components/ionSideMenuContainer/ionSideMenuContainer.js
2015-01-31 12:08:27 -08:00

40 lines
832 B
JavaScript

IonSideMenu = {
snapper: null
};
Template.ionSideMenuContainer.created = function () {
this.data = this.data || {};
this.side = this.data.side || 'both';
this.dragContent = true;
if (typeof this.data.dragContent != 'undefined') {
this.dragContent = this.data.dragContent
}
};
Template.ionSideMenuContainer.rendered = function () {
$snapperEl = this.$('.snap-content');
if (!$snapperEl) {
return;
}
var disable;
if (this.side == 'both') {
disable = 'none';
}
if (this.side == 'left') {
disable = 'right';
}
if (this.side == 'right') {
disable = 'left';
}
IonSideMenu.snapper = new Snap({
element: $snapperEl.get(0),
disable: disable,
touchToDrag: this.dragContent
});
};
Template.ionSideMenuContainer.destroyed = function () {
IonSideMenu.snapper = null;
};