-
Notifications
You must be signed in to change notification settings - Fork 6
/
index.html
253 lines (215 loc) · 5.75 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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
<!DOCTYPE HTML>
<html>
<head>
<title>Adaptive Web App UI with CSS Regions</title>
<meta name="viewport" content="width=device-width, user-scalable=false;">
<meta charset="UTF-8">
<style type="text/css">
* {
box-sizing: border-box;
}
html,
body{
height: 100%;
margin: 0;
min-width: 20rem;
font-family: helvetica, arial, sans-serif;
}
header{
background: #eee;
padding: 1rem 0;
}
.wrapper{
max-width: 45rem;
margin: 0 auto;
padding: 0 1.5rem;
position: relative;
}
#app{
height: 100%;
position: relative;
background: white;
-webkit-transition: -webkit-transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
-moz-transition: -moz-transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
-ms-transition: -ms-transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
transition: transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
}
body.menu-open #app{
-webkit-transform: translateX(10rem);
-moz-transform: translateX(10rem);
-ms-transform: translateX(10rem);
transform: translateX(10rem);
}
#menu{
background: black;
display: block;
width: 15rem;
height: 100%;
position: absolute;
z-index: -1;
}
.control,
input[type="search"]{
height: 2rem;
margin: 0;
padding: 0;
vertical-align: top;
display: inline-block;
text-decoration: none;
}
input[type="search"]{
-webkit-appearance: none;
-moz-appearance: none;
border: 1px solid #d7d7d7;
width: auto;
width: 50%;
font-size: 120%;
}
.control{
background: black;
padding: 0.5rem 0.7rem;
height: auto;
color: white;
cursor: pointer;
}
#account,
#language{
float: right;
}
#account{
margin-right: 0.7rem;
background: rgb(255, 186, 0);
}
#language{
background: rgb(207, 103, 135);
}
#menu-toggle{
display: none;
}
ol{
list-style-position: inside;
padding: 0rem 0 2rem;
}
li{
padding: 1rem 0;
border-bottom: 1px solid #d7d7d7;
color: #444;
font-size: 1.1rem;
}
footer .control{
background: rgb(93, 144, 225);
}
.tip{
background: #ffc;
padding: 1rem;
line-height: 150%;
}
.tip.warning{
background: pink;
}
@media screen and (min-width: 28rem){
footer {
text-align: center;
}
footer .control + .control{
margin-left: 0.7rem;
}
}
@media screen and (max-width: 28rem){
#account, #language, footer a{
-webkit-flow-into: controls;
-ms-flow-into: controls;
flow-into: controls;
display: block;
float: none;
padding: 0.5rem 0.7rem;
margin: 0;
border-bottom: 1px solid #444;
}
footer .control{
text-decoration: none;
display: block;
}
#menu{
-webkit-flow-from: controls;
-ms-flow-from: controls;
flow-from: controls;
}
#menu-toggle{
display: inline-block;
max-width: 20%;
overflow: hidden;
}
input[type="search"]{
width: 75%;
display: inline-block;
float: right;
}
}
</style>
</head>
<body>
<aside id="menu">
<!-- the menu is populated with CSS Regions on narrow viewports -->
</aside>
<div id="app">
<header>
<div class="wrapper">
<!-- the menu toggle is visible only on narrow viewports -->
<a href="#" class="control" id="menu-toggle">Menu</a>
<input type="search" results="5" placeholder='Search for ...'/>
<a href="#" class="control" id="language">Language</a>
<a href="#" class="control" id="account">Account</a>
</div>
</header>
<div class="wrapper">
<p class="tip"><strong>Tip: Resize the browser window.</strong> Notice the buttons above and links at the bottom go into the slide-out menu when the viewport is too narrow. See the <a href="http://blogs.adobe.com/webplatform/?p=3420">Adaptive Web App UI with CSS Regions</a> blog post for details.</p>
<ol>
<li>List item one</li>
<li>List item two</li>
<li>List item three</li>
<li>List item four</li>
<li>List item five</li>
<li>List item six</li>
<li>List item seven</li>
<li>List item eight</li>
</ol>
<footer>
<nav>
<a href="#" class="control">Terms of Service</a>
<a href="#" class="control">Privacy Policy</a>
<a href="#" class="control">Feedback</a>
</nav>
</footer>
</div>
</div>
<script>
// Ask for manual control of the polyfill.
window.cssRegionsManualTrigger = true;
</script>
<script type="text/javascript" src="modernizr.custom.js"></script>
<script src="http://fremycompany.github.io/css-regions-polyfill/cssregions.min.js"></script>
<script type="text/javascript">
var toggle = document.querySelector('#menu-toggle')
var body = document.querySelector('body')
function toggleMenu(){
// hide menu if viewport is wide enough
if (window.matchMedia('(min-width: 28rem)').matches){
body.classList.remove('menu-open')
}
else{
body.classList.add('menu-open')
}
}
toggle.addEventListener('click', function(e){
body.classList.toggle('menu-open')
})
window.addEventListener('resize', toggleMenu)
document.addEventListener('DOMContentLoaded', toggleMenu)
// Enable the polyfill if CSS Regions is not supported natively.
if (!Modernizr.regions) {
cssRegions.enablePolyfill();
}
</script>
</body>
</html>