-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtest.html
323 lines (263 loc) · 17.4 KB
/
test.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
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
<!DOCTYPE html>
<html>
<head>
<title>Collapsible Block Test</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=5">
<script type="text/javascript" src="dist/collapsible-block.min.js"></script>
<script type="text/javascript">
var log = function( message ) {
var debugContainer = document.querySelector( '.debug-container' );
if ( debugContainer ) {
var newMessage = document.createElement( 'p' );
newMessage.innerText = message;
debugContainer.appendChild( newMessage );
}
}
var initCollapsibleBlocks = function() {
if ( window.CollapsibleBlock ) {
CollapsibleBlock.init();
log( 'Collapsible Blocks initialized.' );
}
else {
log( 'Collapsible Blocks isn\'t loaded.' );
}
}
window.addEventListener( "DOMContentLoaded", function () { log( 'DOM Content loaded' ); } );
window.addEventListener( "DOMContentLoaded", function () { initCollapsibleBlocks(); } );
window.addEventListener( "load", function () { log( 'Page loaded' ); } );
</script>
<style type="text/css">
* {
box-sizing: border-box;
}
hr {
margin-top: 30px;
margin-bottom: 30px;
}
.is-collapsed:not( .is-activated ) [data-collapsible-content] {
display: none;
}
.collapsible-block__handler {
display: inline-block;
margin-top: 10px;
padding: 5px 10px;
background-color: #f9f9f9;
cursor: pointer;
}
.disconnected-handler .collapsible-block__handler {
background-color: #f7bdbd;
}
.collapsible-content__inner {
padding: 20px;
background-color: #f3f3f3;
border: solid 2px #ddd;
}
#collapsible-content-multi-target-1 .collapsible-content__inner {
background-color: #a3f3f3;
}
#collapsible-content-multi-target-2 .collapsible-content__inner {
background-color: #f3a3f3;
}
#collapsible-content-multi-target-3 .collapsible-content__inner {
background-color: #f3f3a3;
}
#collapsible-handler-to-hide .collapsible-content__inner {
padding: 0;
background-color: #fff;
border: none;
}
.collapsible-content strong {
display: block;
margin-bottom: 10px;
}
</style>
</head>
<body>
<hr/>
<h2>One collapsible block -- Initially collapsed</h2>
<div class="collapsible-blocks__group">
<div class="is-collapsed" data-collapsible>
<a href="#" class="collapsible-block__handler" data-collapsible-handler>
Toggle State
</a>
<div class="collapsible-content" data-collapsible-content data-collapsible-initial-state="collapsed">
<strong>Collapsible Content</strong><br>
Cupcake ipsum dolor sit amet brownie. Tootsie roll lollipop chocolate cake soufflé sweet roll gingerbread gummi bears dragée. Tootsie roll soufflé lemon drops. Cheesecake dragée jujubes cake jelly cookie caramels marzipan ice cream. Pastry jelly candy pastry halvah. Brownie tiramisu halvah. Pie gummi bears topping marzipan gummi bears jelly-o bonbon jelly-o jujubes. Croissant pudding liquorice lollipop jelly-o sweet chocolate cake caramels marzipan. Chocolate halvah marzipan wafer dessert toffee pastry croissant. Dragée ice cream lemon drops chocolate cake toffee fruitcake caramels sesame snaps carrot cake. Powder powder marzipan muffin cake danish pie. Lemon drops sesame snaps chocolate muffin apple pie fruitcake chocolate cake marzipan topping. Jelly beans brownie cake jelly beans tiramisu lemon drops chocolate carrot cake sugar plum.<br><br>
<a href="https://www.google.com/search?q=Pictures+of+cupcakes" target="_blank">Pictures of cupcakes</a><br>
More Cupcake ipsum dolor sit amet brownie. Tootsie roll lollipop chocolate cake soufflé sweet roll gingerbread gummi bears dragée. Tootsie roll soufflé lemon drops. Cheesecake dragée jujubes cake jelly cookie caramels marzipan ice cream. Pastry jelly candy pastry halvah. Brownie tiramisu halvah. Pie gummi bears topping marzipan gummi bears jelly-o bonbon jelly-o jujubes. Croissant pudding liquorice lollipop jelly-o sweet chocolate cake caramels marzipan. Chocolate halvah marzipan wafer dessert toffee pastry croissant. Dragée ice cream lemon drops chocolate cake toffee fruitcake caramels sesame snaps carrot cake. Powder powder marzipan muffin cake danish pie. Lemon drops sesame snaps chocolate muffin apple pie fruitcake chocolate cake marzipan topping. Jelly beans brownie cake jelly beans tiramisu lemon drops chocolate carrot cake sugar plum.
</div>
</div>
</div>
<hr/>
<h2>One collapsible block -- Initially expanded</h2>
<div class="collapsible-blocks__group">
<div data-collapsible>
<a href="#" class="collapsible-block__handler" data-collapsible-handler>
Toggle State
</a>
<div class="collapsible-content" data-collapsible-content data-collapsible-initial-state="expanded">
<div class="collapsible-content__inner">
<strong>Collapsible Content</strong><br>
Cupcake ipsum dolor sit amet brownie. Tootsie roll lollipop chocolate cake soufflé sweet roll gingerbread gummi bears dragée. Tootsie roll soufflé lemon drops. Cheesecake dragée jujubes cake jelly cookie caramels marzipan ice cream. Pastry jelly candy pastry halvah. Brownie tiramisu halvah. Pie gummi bears topping marzipan gummi bears jelly-o bonbon jelly-o jujubes. Croissant pudding liquorice lollipop jelly-o sweet chocolate cake caramels marzipan. Chocolate halvah marzipan wafer dessert toffee pastry croissant. Dragée ice cream lemon drops chocolate cake toffee fruitcake caramels sesame snaps carrot cake. Powder powder marzipan muffin cake danish pie. Lemon drops sesame snaps chocolate muffin apple pie fruitcake chocolate cake marzipan topping. Jelly beans brownie cake jelly beans tiramisu lemon drops chocolate carrot cake sugar plum.
</div>
</div>
</div>
</div>
<hr/>
<h2>Multi collapsible block -- First expanded</h2>
<div class="collapsible-blocks__group">
<div data-collapsible>
<a href="#" class="collapsible-block__handler" data-collapsible-handler>
Toggle State 1
</a>
<div class="collapsible-content" data-collapsible-content data-autofocus>
<div class="collapsible-content__inner">
<strong>Collapsible Content</strong><br>
Cupcake ipsum dolor sit amet brownie. Tootsie roll lollipop chocolate cake soufflé sweet roll gingerbread gummi bears dragée. Tootsie roll soufflé lemon drops. Cheesecake dragée jujubes cake jelly cookie caramels marzipan ice cream. Pastry jelly candy pastry halvah. Brownie tiramisu halvah. Pie gummi bears topping marzipan gummi bears jelly-o bonbon jelly-o jujubes. Croissant pudding liquorice lollipop jelly-o sweet chocolate cake caramels marzipan. Chocolate halvah marzipan wafer dessert toffee pastry croissant. Dragée ice cream lemon drops chocolate cake toffee fruitcake caramels sesame snaps carrot cake.
<div data-collapsible>
<a href="#" class="collapsible-block__handler" data-collapsible-handler>
Toggle Nested collapsible
</a>
<div class="collapsible-content" data-collapsible-content>
<div class="collapsible-content__inner">
<strong>Nested Collapsible Content with autofocus element</strong><br>
Cupcake ipsum dolor sit amet brownie. Tootsie roll lollipop chocolate cake soufflé sweet roll gingerbread gummi bears dragée. Tootsie roll soufflé lemon drops. Cheesecake dragée jujubes cake jelly cookie caramels marzipan ice cream. Pastry jelly candy pastry halvah. Brownie tiramisu halvah. Pie gummi bears topping marzipan gummi bears jelly-o bonbon jelly-o jujubes. Croissant pudding liquorice lollipop jelly-o sweet chocolate cake caramels marzipan. Chocolate halvah marzipan wafer dessert toffee pastry croissant. Dragée ice cream lemon drops chocolate cake toffee fruitcake caramels sesame snaps carrot cake.
<p>
<label>
First focusable element:<br>
<input type="text" placeholder="This is the first focusable element" data-autofocus />
</label>
</p>
<p>
<button type="button">Do nothing</button>
</p>
Powder powder marzipan muffin cake danish pie. Lemon drops sesame snaps chocolate muffin apple pie fruitcake chocolate cake marzipan topping. Jelly beans brownie cake jelly beans tiramisu lemon drops chocolate carrot cake sugar plum.
</div>
</div>
</div>
<p>
<label>
First focusable element:<br>
<input type="text" placeholder="This is the first focusable element" />
</label>
</p>
<p>
<button type="button">Do nothing</button>
</p>
Powder powder marzipan muffin cake danish pie. Lemon drops sesame snaps chocolate muffin apple pie fruitcake chocolate cake marzipan topping. Jelly beans brownie cake jelly beans tiramisu lemon drops chocolate carrot cake sugar plum.
</div>
</div>
</div>
<div data-collapsible>
<a href="#" class="collapsible-block__handler" data-collapsible-handler>
Toggle State 2
</a>
<div class="collapsible-content" data-collapsible-content>
<div class="collapsible-content__inner">
<strong>Collapsible Content</strong><br>
Cupcake ipsum dolor sit amet brownie. Tootsie roll lollipop chocolate cake soufflé sweet roll gingerbread gummi bears dragée. Tootsie roll soufflé lemon drops. Cheesecake dragée jujubes cake jelly cookie caramels marzipan ice cream. Pastry jelly candy pastry halvah. Brownie tiramisu halvah. Pie gummi bears topping marzipan gummi bears jelly-o bonbon jelly-o jujubes. Croissant pudding liquorice lollipop jelly-o sweet chocolate cake caramels marzipan. Chocolate halvah marzipan wafer dessert toffee pastry croissant. Dragée ice cream lemon drops chocolate cake toffee fruitcake caramels sesame snaps carrot cake. Powder powder marzipan muffin cake danish pie. Lemon drops sesame snaps chocolate muffin apple pie fruitcake chocolate cake marzipan topping. Jelly beans brownie cake jelly beans tiramisu lemon drops chocolate carrot cake sugar plum.
</div>
</div>
</div>
<div data-collapsible>
<a href="#" class="collapsible-block__handler" data-collapsible-handler>
Toggle State 3
</a>
<div class="collapsible-content" data-collapsible-content>
<div class="collapsible-content__inner">
<strong>Collapsible Content</strong><br>
Cupcake ipsum dolor sit amet brownie. Tootsie roll lollipop chocolate cake soufflé sweet roll gingerbread gummi bears dragée. Tootsie roll soufflé lemon drops. Cheesecake dragée jujubes cake jelly cookie caramels marzipan ice cream. Pastry jelly candy pastry halvah. Brownie tiramisu halvah. Pie gummi bears topping marzipan gummi bears jelly-o bonbon jelly-o jujubes. Croissant pudding liquorice lollipop jelly-o sweet chocolate cake caramels marzipan. Chocolate halvah marzipan wafer dessert toffee pastry croissant. Dragée ice cream lemon drops chocolate cake toffee fruitcake caramels sesame snaps carrot cake. Powder powder marzipan muffin cake danish pie. Lemon drops sesame snaps chocolate muffin apple pie fruitcake chocolate cake marzipan topping. Jelly beans brownie cake jelly beans tiramisu lemon drops chocolate carrot cake sugar plum.
</div>
</div>
</div>
</div>
<hr/>
<h2>Targetting a disconnected collapsible block content element</h2>
<div>The collapsible block below does not follow the recommended HTML structure but it is still possible to control it's state with a handler element that is not connected to the collapsible content section by the HTML structure. For that it is necessary that the `id` attribute of the content element is set manually (or at least known).</div>
<div class="disconnected-handler">
<a href="#" class="collapsible-block__handler" data-collapsible-handler aria-controls="collapsible-content-disconnected">
Toggle State
</a>
</div>
<div class="collapsible-blocks__group">
<div id="collapsible-content-disconnected" class="collapsible-content" data-collapsible data-collapsible-content data-collapsible-initial-state="collapsed">
<div class="collapsible-content__inner">
<strong>#collapsible-content-disconnected</strong><br>
Cupcake ipsum dolor sit amet brownie. Tootsie roll lollipop chocolate cake soufflé sweet roll gingerbread gummi bears dragée. Tootsie roll soufflé lemon drops. Cheesecake dragée jujubes cake jelly cookie caramels marzipan ice cream. Pastry jelly candy pastry halvah. Brownie tiramisu halvah. Pie gummi bears topping marzipan gummi bears jelly-o bonbon jelly-o jujubes. Croissant pudding liquorice lollipop jelly-o sweet chocolate cake caramels marzipan. Chocolate halvah marzipan wafer dessert toffee pastry croissant. Dragée ice cream lemon drops chocolate cake toffee fruitcake caramels sesame snaps carrot cake. Powder powder marzipan muffin cake danish pie. Lemon drops sesame snaps chocolate muffin apple pie fruitcake chocolate cake marzipan topping. Jelly beans brownie cake jelly beans tiramisu lemon drops chocolate carrot cake sugar plum.
</div>
</div>
</div>
<hr/>
<h2>Toggle multiple targets</h2>
<div>The toggle button below will toggle the states (expand or collapsed) for each collapsible block set as a target.</div>
<a href="#" class="collapsible-block__handler" data-collapsible-handler data-collapsible-targets="collapsible-content-multi-target-1, collapsible-content-multi-target-2, collapsible-content-multi-target-3, non-existent-id">
Expand content and hide toggle button
</a>
<div class="collapsible-blocks__group">
<div id="collapsible-content-multi-target-1" class="collapsible-content" data-collapsible data-collapsible-content>
<div class="collapsible-content__inner">
<strong>#collapsible-content-multi-target-1</strong><br>
Sugar plum biscuit fruitcake. Dragée candy canes dragée carrot cake. Cake macaroon lemon drops soufflé carrot cake sesame snaps toffee candy. Cupcake gummi bears jujubes bear claw sweet roll. Sweet roll cheesecake cake cheesecake. Toffee jelly topping biscuit cupcake. Marshmallow lollipop wafer chupa chups. Brownie cookie carrot cake.
</div>
</div>
<div id="collapsible-content-multi-target-2" class="collapsible-content" data-collapsible data-collapsible-content>
<div class="collapsible-content__inner">
<strong>#collapsible-content-multi-target-2</strong><br>
Tiramisu halvah chocolate bar croissant cotton candy candy canes topping tootsie roll cupcake. Cake dessert jelly. Liquorice liquorice chocolate bar. Candy cotton candy carrot cake.
<p>
<label>
First focusable element:<br>
<input type="text" placeholder="This is the first focusable element" />
</label>
</p>
<p>
<label>
Second focusable element (autofocus):<br>
<input type="text" data-autofocus placeholder="This is the second focusable element" />
</label>
</p>
<p>
<button type="button">Do nothing</button>
</p>
Apple pie marzipan jujubes dragée. Jelly-o ice cream donut candy chupa chups tiramisu cake. Lemon drops sweet gingerbread sweet danish marzipan. Jelly beans jujubes candy lollipop toffee topping candy. Muffin cake oat cake.
</div>
</div>
<div id="collapsible-content-multi-target-3" class="collapsible-content" data-collapsible data-collapsible-content>
<div class="collapsible-content__inner">
<strong>#collapsible-content-multi-target-3</strong><br>
Jujubes pastry cotton candy. Biscuit liquorice wafer pastry pudding lemon drops fruitcake pie halvah. Gummies oat cake tiramisu biscuit. Lollipop dessert pie. Pie jelly oat cake chocolate bar. Gummies jelly jujubes topping toffee jelly toffee pudding. Jujubes donut caramels. Muffin topping tiramisu icing powder chocolate cake ice cream cotton candy.
</div>
</div>
</div>
<hr/>
<h2>Multiple targets (one-way, hides toggle button)</h2>
<div>The toggle button below will expand the collapsed block with content and hide the collapsible block which contains the toggle link.</div>
<div class="collapsible-blocks__group">
<div id="collapsible-handler-to-hide" class="collapsible-content" data-collapsible data-collapsible-content data-collapsible-initial-state="expanded">
<div class="collapsible-content__inner">
<a href="#" class="collapsible-block__handler" data-collapsible-handler data-collapsible-targets="collapsible-handler-to-hide, collapsible-content-to-show">
Expand content and hide toggle button
</a>
</div>
</div>
<div id="collapsible-content-to-show" class="collapsible-content" data-collapsible data-collapsible-content data-collapsible-initial-state="collapsed" data-autofocus>
<div class="collapsible-content__inner">
Cupcake ipsum dolor sit amet brownie. Tootsie roll lollipop chocolate cake soufflé sweet roll gingerbread gummi bears dragée. Tootsie roll soufflé lemon drops. Cheesecake dragée jujubes cake jelly cookie caramels marzipan ice cream. Pastry jelly candy pastry halvah. Brownie tiramisu halvah. Pie gummi bears topping marzipan gummi bears jelly-o bonbon jelly-o jujubes. Croissant pudding liquorice lollipop jelly-o sweet chocolate cake caramels marzipan. Chocolate halvah marzipan wafer dessert toffee pastry croissant. Dragée ice cream lemon drops chocolate cake toffee fruitcake caramels sesame snaps carrot cake.
<p>
<label>
First focusable element:<br>
<input type="text" placeholder="This is the first focusable element" value="Should auto-select the text" />
</label>
</p>
<p>
<button type="button">Do nothing</button>
</p>
Powder powder marzipan muffin cake danish pie. Lemon drops sesame snaps chocolate muffin apple pie fruitcake chocolate cake marzipan topping. Jelly beans brownie cake jelly beans tiramisu lemon drops chocolate carrot cake sugar plum.
</div>
</div>
</div>
<hr/>
<div class="debug-container">
</div>
</body>
</html>