Files
ionic-framework/hacking/sideMenu.html
2013-09-23 00:44:33 -05:00

86 lines
2.7 KiB
HTML

<html>
<head>
<meta charset="utf-8">
<title>Side Menu</title>
<!-- Sets initial viewport load and disables zooming -->
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">
<link href="/vendor/font-awesome/css/font-awesome.css" rel="stylesheet">
<link rel="stylesheet" href="../dist/ionic.css">
</head>
<body>
<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>
<h1 class="title">Tab Bars</h1>
</header>
<main class="has-header content content-padded">
<h1>Swipe me, side to side</h1>
</main>
</section>
<section id="my-left-panel" class="menu menu-left">
<h1>LEFT</h1>
</section>
<section id="my-right-panel" class="menu menu-right">
<h1>RIGHT</h1>
</section>
<script src="../../js/events.js"></script>
<script src="../../js/gestures.js"></script>
<script src="../../js/views/sideMenu.js"></script>
<script src="../../js/controllers/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 ionic.ui.SideMenu({ el: document.getElementById('my-left-panel'), width: 270 });
var r = new ionic.ui.SideMenu({ el: document.getElementById('my-right-panel'), width: 270 });
var c = new Controller({ el: document.getElementById('content'), animateClass: 'menu-animated' });
var ctrl = new ionic.controllers.SideMenuController({
left: l,
right: r,
content: c
});
</script>
</body>
</html>