Files
ionic-framework/test/tab-bars.html
2013-09-27 17:59:18 -05:00

97 lines
2.6 KiB
HTML

<html>
<head>
<meta charset="utf-8">
<title>Tab Bars</title>
<!-- Sets initial viewport load and disables zooming -->
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">
<link href="../dist/ionic.css" rel="stylesheet">
<style>
.content {
height: 100%;
}
.bar-header {
position: relative;
}
.tabs {
position: relative;
margin-top: 10px;
}
</style>
</head>
<body>
<section>
<header class="bar bar-header bar-dark">
<h1 class="title">Tab Bars</h1>
</header>
<main class="content padded has-header">
content
</main>
<nav id="tab-bar" class="tabs tabs-default">
<a class="tab-item tab-item-danger" href="#">
<i class="icon-star"></i>
Friends
</a>
<a class="tab-item tab-item-danger">
<i class="icon-star-filled"></i>
Enemies
</a>
<a class="tab-item tab-item-danger">
<i class="icon-clock"></i>
Settings
</a>
<a class="tab-item tab-item-danger">
<i class="icon-keypad-filled"></i>
More
</a>
</nav>
</section>
<script src="../dist/ionic.js"></script>
<script>
var sec = document.getElementsByTagName('section')[0];
var types = ['default', 'secondary', 'primary', 'info', 'success', 'warning', 'danger', 'dark'];
for(var i = 0; i < types.length; i++) {
var t = types[i];
sec.innerHTML += '<nav id="tab-bar" class="tabs tabs-' + t + '">' +
'<a class="tab-item" href="#">'+
'<i class="icon-star"></i>' +
'Friends' +
'</a>' +
'<a class="tab-item">' +
'<i class="icon-star-filled"></i>' +
'Enemies' +
'</a>' +
'<a class="tab-item">' +
'<i class="icon-clock"></i>' +
'Settings' +
'</a>' +
'<a class="tab-item">' +
'<i class="icon-keypad-filled"></i>' +
'More' +
'</a>' +
'</nav>';
}
var buttons = document.querySelectorAll('.tab-item');
var a;
for(var i = 0; i < buttons.length; i++) {
a = buttons[i];
a.addEventListener('touchstart', function() {
this.classList.add('active');
});
a.addEventListener('touchend', function() {
this.classList.remove('active');
});
a.addEventListener('touchcancel', function() {
this.classList.remove('active');
});
}
</script>
</body>
</html>