Trying to get the side menus to work again

This commit is contained in:
Max Lynch
2013-09-20 15:21:26 -05:00
parent fcb64f390a
commit 8e8688c7e6
3 changed files with 60 additions and 6 deletions

View File

@ -18,7 +18,6 @@
this.content.endDrag = function(e) {
_this._endDrag(e);
};
};
SideMenuController.prototype = {

View File

@ -10,7 +10,7 @@
</head>
<body>
<section>
<section id="content" class="full-section menu-animated">
<header class="bar bar-header bar-dark">
<a href="#" class="button"><i class="icon-reorder"></i></a>
@ -21,12 +21,67 @@
<h1>Swipe me, side to side</h1>
</main>
</section>
<section id="my-left-panel" class="menu menu-left">
<ul class="list">
</ul>
</section>
<section id="my-right-panel" class="menu menu-right">
<ul class="list">
</ul>
</section>
<script src="../../js/ionic-events.js"></script>
<script src="../../js/ionic-gestures.js"></script>
<script src="TabBar.js"></script>
<script src="TabBarController.js"></script>
<script src="SideMenu.js"></script>
<script src="SideMenuController.js"></script>
<script>
var Controller = function(opts) {
var _this = this;
this.el = opts.el;
this.animateClass = opts.animateClass;
// Bind release and drag listeners
window.ionic.onGesture('drag', function(e) {
_this.onDrag && _this.onDrag(e);
}, this.el);
window.ionic.onGesture('release', function(e) {
_this.endDrag && _this._endDrag(e);
}, this.el);
};
Controller.prototype = {
onDrag: function(e) {},
endDrag: function(e) {},
getTranslateX: function() {
var r = /translate3d\((-?.+)px/;
var d = r.exec(this.el.style.webkitTransform);
if(d && d.length > 0) {
return parseFloat(d[1]);
}
return 0;
},
setTranslateX: function(amount) {
this.el.style.webkitTransform = 'translate3d(' + amount + 'px, 0, 0)';
},
enableAnimation: function() {
this.el.classList.add(this.animateClass);
},
disableAnimation: function() {
this.el.classList.remove(this.animateClass);
}
};
var l = new SideMenu({ el: document.getElementById('my-left-panel'), width: 270 });
var r = new SideMenu({ el: document.getElementById('my-right-panel'), width: 270 });
var c = new Controller({ el: document.createElement('content') });
var ctrl = new SideMenuController({
left: l,
right: r,
content: c
});
</script>
</body>
</html>

View File

@ -100,8 +100,8 @@
ionic.on = function() { ionic.EventController.on.apply(ionic.EventController, arguments); }
ionic.off = function() { ionic.EventController.off.apply(ionic.EventController, arguments); }
ionic.trigger = function() { ionic.EventController.trigger.apply(ionic.EventController.trigger, arguments); }
ionic.onGensture = function() { ionic.EventController.onGesture.apply(ionic.EventController.onGesture, arguments); }
ionic.offGensture = function() { ionic.EventController.offGesture.apply(ionic.EventController.offGesture, arguments); }
ionic.onGesture = function() { ionic.EventController.onGesture.apply(ionic.EventController.onGesture, arguments); }
ionic.offGesture = function() { ionic.EventController.offGesture.apply(ionic.EventController.offGesture, arguments); }
// Set up various listeners
window.addEventListener('click', ionic.EventController.handleClick);