-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathslideout.html
More file actions
155 lines (140 loc) · 2.93 KB
/
slideout.html
File metadata and controls
155 lines (140 loc) · 2.93 KB
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
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Slideout Demo</title>
<meta http-equiv="cleartype" content="on">
<meta name="MobileOptimized" content="320">
<meta name="HandheldFriendly" content="True">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<script src="lib/snap.min.js"></script>
</head>
<body>
<script>
$(function() {
$.sidebars = new Snap({
element: document.getElementById('content'),
maxPosition: 100,
minPosition: -100
});
$(document)
.on('click', '.nav-toggle-left', function() {
if ($.sidebars.state().state == "left") {
$.sidebars.close();
} else {
$.sidebars.open('left');
}
})
.on('click', '.nav-toggle-right', function() {
if ($.sidebars.state().state == "right") {
$.sidebars.close();
} else {
$.sidebars.open('right');
}
});
});
</script>
<style>
body {
margin: 0;
width: 100%;
height: 100%;
}
.app .app-header {
overflow: hidden;
background: #fee65e;
border-bottom: solid 2px #ffaa42;
text-align: center;
text-shadow: 1px 1px 0 #fcfdf4;
}
.app .app-header h1 {
display: inline-block;
margin: 0;
font-family: 'Roboto', 'Helvetica Neue', 'Helvetica', sans-serif;
font-size: 22px;
font-weight: bold;
line-height: 50px;
color: #e64a33;
}
.app .nav-toggle-left, .app .nav-toggle-right {
position: relative;
float: left;
display: block;
width: 50px;
height: 30px;
margin: 10px;
background: #fdef6e;
border: solid 1px rgba(230,74,51,0.35);
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
-ms-border-radius: 3px;
-o-border-radius: 3px;
border-radius: 3px;
-webkit-box-shadow: inset 0 1px 0 #fcfdf4;
-moz-box-shadow: inset 0 1px 0 #fcfdf4;
box-shadow: inset 0 1px 0 #fcfdf4;
white-space: nowrap;
color: #e64a33;
line-height: 29px;
}
.app .app-header .nav-toggle-left {
float: left;
}
.app .app-header .nav-toggle-right {
float: right;
}
.snap-drawers {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
width: auto;
height: auto;
}
.snap-drawers .snap-drawer-left, .snap-drawers .snap-drawer-right {
position: absolute;
top: 0;
right: auto;
bottom: 0;
left: auto;
width: 100px;
height: auto;
overflow: auto;
background: #323949;
color: #eee;
}
.snap-drawers .snap-drawer-left {
left: -100px;
z-index: 1;
}
.snap-drawers .snap-drawer-right {
right: -100px;
z-index: 1;
}
.snap-content {
z-index: 2;
}
</style>
<div id="content" class="app">
<div class="snap-drawers">
<div class="snap-drawer snap-drawer-left">
Left bar
</div>
<div class="snap-drawer snap-drawer-right">
Right bar
</div>
</div>
<div class="snap-content">
<header class="app-header">
<a class="nav-toggle-left" data-role="left">☰</a>
<h1>Title</h1>
<a class="nav-toggle-right" data-role="right">☰</a>
</header>
Hello World
</div>
</div>
</body>
</html>