forked from mobify/pikabu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
170 lines (154 loc) · 7.57 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
<!doctype html>
<html class="no-js">
<head>
<title>Mobify's Pikabu - a simple off-canvas flyout framework</title>
<!-- include pikabu.css -->
<link rel="stylesheet" href="src/pikabu.css">
<link rel="stylesheet" href="src/pikabu-theme.css">
<link href='http://fonts.googleapis.com/css?family=Roboto:300,400,700' rel='stylesheet' type='text/css'>
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<script type="text/javascript">
// Scroll the page past URL bar if user did not scroll manually, and
// hash is either absent or is a mobify properties override.
window.onload=function(){
setTimeout(function() {
if (!window.pageYOffset) {
window.scrollTo(0, 1);
window.scrollTo(0, 0);
}
}, 250);
};
</script>
<style>
.m-heights-demo .is-active a {
color: #000;
text-decoration: none
}
/* Used to add extra height to elements for demo purposes */
.m-dummy-height {
height: 500px;
}
</style>
</head>
<body>
<!-- the viewport -->
<div class="m-pikabu-viewport">
<!-- the left sidebar -->
<div class="m-pikabu-sidebar m-pikabu-left">
<!-- left sidebar content -->
<h2>Left</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.
Fugiat, minus, beatae, molestias sint sunt possimus
quisquam commodi vel incidunt alias repellendus voluptatum
nisi voluptates cumque laboriosam nesciunt optio magnam
eligendi.</p>
<ul>
<li><a href="#">This is a link</a></li>
<li><a href="#">This is a link</a></li>
<li><a href="#">This is a link</a></li>
<li><a href="#">This is a link</a></li>
<li><a href="#">This is a link</a></li>
</ul>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ab
ipsum nisi qui odit magni atque dicta numquam sed. Consequatur,
illo, harum nulla non velit quas accusantium minus ad unde
facilis.</p>
<p><a href="#">Link</a></p>
</div>
<!-- the main page content -->
<div class="m-pikabu-container">
<header>
<a class="m-pikabu-nav-toggle" data-role="left">Left Menu</a>
<h1>Pikabu</h1>
<a class="m-pikabu-nav-toggle" data-role="right">Right Menu</a>
</header>
<section>
<!-- Body content goes in here -->
<h2><strong>Pikabu</strong> is a speedy, flexible framework for off-canvas flyout panels.</h2>
<h3>Why use <strong>Pikabu</strong>?</h3>
<p><em>Simple markup</em> — Few containers and classes means implementation is a breeze.</p>
<p><em>Native scrolling</em> — Just like mom used to make. Momentum scrolling in sidebars and smart fallbacks for browsers that don’t support it.</p>
<p><em>Customization</em> — No theme, just barebones HTML and CSS. Pikabu is super customizable to your needs.</p>
<p><em>Compatibility</em> — This thing works on everything. We progressively enhance the experience for devices that support it.</p>
</section>
</div>
<!-- the right sidebar -->
<div class="m-pikabu-sidebar m-pikabu-right">
<!-- right sidebar content -->
<h2>Height Demos</h2>
<p>Here's what Pikabu looks with content of differing heights:</p>
<ul class="m-heights-demo">
<li class="is-active">
<a href="#" data-target="">Layout Demo 1: Default</a>
</li>
<li>
<a href="#" data-target=".m-pikabu-container">Layout Demo 2: Taller content</a>
</li>
<li>
<a href="#" data-target=".m-pikabu-left">Layout 3: Taller Sidebar</a>
</li>
</ul>
</div>
</div>
<!-- include zepto.js or jquery.js -->
<!-- <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/zepto/1.0/zepto.min.js"></script> -->
<script src="libs/jquery/jquery.js"></script>
<!-- include pikabu.js -->
<script type="text/javascript" src="src/pikabu.js"></script>
<script>
$(function() {
pikabu = new Pikabu();
// Script to adjust element heights for demo
$('.m-heights-demo').on('click', 'a', function(e) {
var $link = $(this), target = $link.data('target');
e.preventDefault();
$('.is-active').removeClass('is-active');
$link.parents('li').addClass('is-active');
$('.m-dummy-height').remove();
target && $(target).append($('<div class="m-dummy-height">'));
pikabu.closeSidebars();
setTimeout(function() {
pikabu.openSidebar('left');
}, 1000);
});
/*
Sample usage:
// All options are optional
pikabu = new Pikabu({
// If you'd like to request different elements be used
// as controls.
// IMPORTANT: If you change the class names here, please
// remember to change the appropriate classes in the
// stylesheets as well.
selectors: {
element: '.main-element-container',
left: '.left-sidebar',
right: '.right-sidebar',
navToggles: '.sidebar-opener',
overlay: '.overlay'
},
// Specify left and right sidebar widths independently
widths: {
left: '70%',
right: '70%'
},
// Functions to trigger on initializing, opening and closing the sidebar
onInit: function() { ... },
onOpened: function() { ... },
onClosed: function() { ... }
});
// Once you've created the pikabu instance like shown above,
// you can use it elsewhere as shown below:
pikabu.openSidebar('right');
pikabu.closeSidebars();
pikabu.activeSidebar // 'left' or 'right'
pikabu.$sidebars[pikabu.activeSidebar] // get the Zepto/jQuery active sidebar object
// Pikabu also provides some utility functions, like:
pikabu.scrollTo(500); // Smooth scroll to 500px in the document
// pikabu.device contains some capability information about the device, like:
pikabu.isAndroid; // returns true/false
*/
});
</script>
</body>
</html>