-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathselectors.html
More file actions
434 lines (336 loc) · 17.1 KB
/
Copy pathselectors.html
File metadata and controls
434 lines (336 loc) · 17.1 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
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
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Metadata for the Webpage -->
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Bootstrapr · Selectors</title>
<!-- Favicons -->
<link rel="apple-touch-icon" sizes="57x57" href="img/favicon/apple-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="img/favicon/apple-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="img/favicon/apple-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="img/favicon/apple-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="img/favicon/apple-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="img/favicon/apple-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144" href="img/favicon/apple-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152" href="img/favicon/apple-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180" href="img/favicon/apple-icon-180x180.png">
<link rel="icon" type="image/png" sizes="192x192" href="img/favicon/android-icon-192x192.png">
<link rel="icon" type="image/png" sizes="32x32" href="img/favicon/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="96x96" href="img/favicon/favicon-96x96.png">
<link rel="icon" type="image/png" sizes="16x16" href="img/favicon/favicon-16x16.png">
<link rel="manifest" href="img/favicon/manifest.json">
<meta name="msapplication-TileColor" content="#ffffff">
<meta name="msapplication-TileImage" content="img/favicon/ms-icon-144x144.png">
<meta name="theme-color" content="#ffffff">
<!-- Bootstrap CSS files-->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<!-- jQuery UI CSS (optional) -->
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/themes/smoothness/jquery-ui.css">
<!-- Google web fonts -->
<link href="https://fonts.googleapis.com/css?family=Montserrat:500,600" rel="stylesheet">
<link rel="stylesheet" href="https://use.typekit.net/cti7nio.css">
<!-- CSS Animations -->
<link href="https://unpkg.com/aos@2.3.1/dist/aos.css" rel="stylesheet">
<!-- Font Awesome Web Icons -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<!-- Main local stylesheet -->
<link rel="stylesheet" href="css/main.css">
<!-- Prettify theme -->
<link rel="stylesheet" href="css/prettify-theme.css">
<style>
.bootstrapr-selector > div {
padding: 1rem;
}
</style>
</head>
<body id="top">
<!-- Navbar include -->
<div w3-include-html="navbar.html"></div>
<div class="container main-content">
<div class="row add-100">
<div class="col-sm-6">
<ol class="breadcrumb">
<li><a href="index.html">Bootstrapr</a></li>
<li class="active">Selectors</li>
</ol>
</div>
<!-- col-sm-6 -->
<div class="col-sm-6">
<p class="pull-right">
<i class="fa fa-fw fa-bookmark gray" aria-hidden="true"></i>
<a href="https://getbootstrap.com/docs/3.3/" target="_blank">Bootstrap 3.3.7</a></p>
</div>
<!-- col-sm-4-->
</div>
<!-- .row -->
<div class="row">
<div class="col-sm-12">
<h1>Selectors</h1>
<p class="lead">Use a select input to toggle show/hide on content areas.</p>
<p>Select inputs allow you to use a simple form control such as a dropdown input to conveniently hide and show content in <code><divs></code>.</p>
</div>
</div>
<hr class="divider">
<div class="row">
<div class="col-sm-3">
<form>
<div class="form-group">
<label for="num-panels"># Content Sections</label>
<input type="text" class="form-control input-number" id="num-sections">
</div>
<div class="form-group push-down-1">
<label for="selector-size">Size</label>
<select class="form-control " id="selector-size">
<option value=" input-lg">Large</option>
<option value="" selected="selected">Standard</option>
<option value=" input-sm">Small</option>
</select>
</div>
<label for="first-selected" class="push-down-1">Select First Option</label>
<div class="checkbox">
<label class='switch'>
<input type="checkbox" id="first-selected">
<span class="slider round"></span>
</label>
</div>
</form>
<div class="push-down-3" id="action-buttons">
<button type="button" class="btn btn-primary pull-right" id="build-button"><i class="fa fa-fw fa-cogs" aria-hidden="true"></i> Build </button>
<button type="button" class="btn btn-default pull-right" id="clear-form"><i class="fa fa-refresh fa-fw" aria-hidden="true"></i> <span class="hidden-xs hidden-sm">Reset</span></button>
</div>
</div>
<!-- col-sm-3 -->
<div class="col-sm-9">
<div class="example" id="simple-example">
<div class="bootstrapr-selector">
<!-- The input selector -->
<form style="margin-bottom: 2rem">
<select class="form-control input-lg" id="selector-1001001">
<option disabled="disabled" value="" selected="selected"> -- Select -- </option>
<option value="#content-div-1">Show section 1</option>
<option value="#content-div-2">Show section 2</option>
<option value="#content-div-3">Show section 3</option>
<option value="#content-div-4">Show section 4</option>
</select>
</form>
<!-- The content divs -->
<div id="content-div-1" class="selector-content hidden">
<p>This is the content for section 1</p>
</div>
<div id="content-div-2" class="selector-content hidden">
<p>This is the content for section 2</p>
</div>
<div id="content-div-3" class="selector-content hidden">
<p>This is the content for section 3</p>
</div>
<div id="content-div-4" class="selector-content hidden">
<p>This is the content for section 4</p>
</div>
</div>
</div>
<!-- example -->
<div class="well">
<!-- Copier-->
<button class="btn btn-code-well pull-right copier" type="button" data-clipboard-demo="" data-clipboard-target="#simple-code" data-toggle="tooltip" data-placement="bottom" title="Copy to Clipboard"><i class="fa fa-fw fa-clipboard"
aria-hidden="true"></i> Copy</button>
<!-- Beautifier -->
<button id="beautify" class="btn btn-code-well pull-left" type="button" data-clipboard-demo="" data-toggle="tooltip" data-placement="bottom" title="Indent code"><i class="fa fa-indent fa-fw" aria-hidden="true"></i> Prettify</button>
<!-- Update Example Panel-->
<button id="update-preview" class="btn btn-code-well pull-left" type="button" data-clipboard-demo="" data-toggle="tooltip" data-placement="bottom" title="Update Example window"><i class="fa fa-fw fa-arrows-v" aria-hidden="true"></i>
Update Example</button>
<hr class="well-separator">
<pre class="prettyprint lang-html" id="simple-code" contenteditable="true">
<div class="bootstrapr-selector">
<!-- The input selector -->
<form>
<select class="form-control input-lg" id="selector-1001001">
<option disabled="disabled" value="" selected="selected">
-- Select --
</option>
<option value="#content-div-1">Show section 1</option>
<option value="#content-div-2">Show section 2</option>
<option value="#content-div-3">Show section 3</option>
<option value="#content-div-4">Show section 4</option>
</select>
</form>
<!-- The content divs -->
<div id="content-div-1" class="selector-content hidden">
<p>This is the content for section 1</p>
</div>
<div id="content-div-2" class="selector-content hidden">
<p>This is the content for section 2</p>
</div>
<div id="content-div-3" class="selector-content hidden">
<p>This is the content for section 3</p>
</div>
<div id="content-div-4" class="selector-content hidden">
<p>This is the content for section 4</p>
</div>
</div>
<!-- bootstrapr-div -->
</pre>
</div>
<!-- well closes -->
<h4 class="sub-header">Custom CSS</h4>
<p>Custom CSS is recommended to add marging and padding to the .</p>
<div class="well">
<!-- Copier-->
<button class="btn btn-code-well pull-right copier" type="button" data-clipboard-demo="" data-clipboard-target="#custom-css-code" data-toggle="tooltip" data-placement="bottom" title="Copy to Clipboard"><i class="fa fa-fw fa-clipboard"
aria-hidden="true"></i> Copy</button>
<!-- Update Example Panel-->
<a id="download-all-css" class="btn btn-code-well pull-left" type="button" data-toggle="tooltip" data-placement="bottom" title="View all Bootstrapr CSS" role="button" href="css/all-bootstrapr-css.css" target="_blank"><i
class="fa fa-fw fa-file-code-o" aria-hidden="true"></i> View all Bootstrapr CSS</a>
<hr class="well-separator">
<pre class="prettyprint lang-css" id="custom-css-code">
.bootstrapr-selector > div {
padding: 1rem;
}
</pre>
</div>
<!-- .well -->
<h4 class="sub-header">Required JS</h4>
<p>Custom jQuery is required to hide and show the divs. Make sure to place the function inside a <code>document.ready</code> function.</p>
<div class="well">
<!-- Copier-->
<button class="btn btn-code-well pull-right copier" type="button" data-clipboard-demo="" data-clipboard-target="#custom-js-code" data-toggle="tooltip" data-placement="bottom" title="Copy to Clipboard"><i class="fa fa-fw fa-clipboard"
aria-hidden="true"></i> Copy</button>
<!-- Beautifier -->
<button id="beautify-selector-js" class="btn btn-code-well pull-left" type="button" data-clipboard-demo="" data-toggle="tooltip" data-placement="bottom" title="Indent code"><i class="fa fa-indent fa-fw" aria-hidden="true"></i>
Prettify</button>
<hr class="well-separator">
<pre class="prettyprint lang-js" id="custom-js-code" contenteditable="true">
$("#selector-1001001").on("change", function() {
$(".bootstrapr-selector div").addClass("hidden");
var showDiv = $("#selector-1001001").val();
$(showDiv).removeClass("hidden");
});
</pre>
</div>
<!-- .well -->
<h4 class="sub-header">Notes</h4>
<div class="alert alert-danger" role="alert">
<p>
<i class="fa fa-times-circle fa-fw" aria-hidden="true"></i>
<a class="close" data-dismiss="alert" aria-label="close">×</a>
<strong>Keep Selector Sets Unique</strong>
<br>
While you may place multiple selector dropdowns on a page...
<strong>do not</strong>
simply cut and paste the same selector again and again. Make sure to generate each new selector anew, ensuring the random number assigned to each one stays unique and does not conlflict with the other sets on the page.
</p>
</div>
</div>
<!-- col-sm-9 -->
</div>
<!-- .row -->
</div>
<!-- .container-fluid -->
<!-- Navbar include -->
<div w3-include-html="footer.html"></div>
<!-- Back-to-top button -->
<a role="button" id="topper" class="btn scroll-link" href="#top"><i class="fa fa-fw fa-2x fa-caret-up" aria-hidden="true"></i></a>
<!-- jQuery Javascript Library (required by Bootstrap) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script><script>window.jQuery || document.write('<script src="js/jquery.min.js"><\/script>')</script>
<!-- jQuery UI Library (optional) -->
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
<!-- Bootstrap Library -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script>window.jQuery.fn.modal || document.write('<script src="js/bootstrap.min.js"><\/script>')</script>
<script>
(function($) {
$(function() {
if ($('body').css('color') !== 'rgb(246, 247, 251)') {
$('head').prepend('<link rel="stylesheet" href="css/bootstrap.min.css">');
$('head').prepend('<link rel="stylesheet" href="css/fontawesome-local.css">');
}
});
})(window.jQuery);
</script>
<!-- Main local script file -->
<script src="js/main.js"></script>
<!-- includes for Google's code highlighter 'prettyprint' -->
<link rel="stylesheet" type="text/css" href="css/prettify.css">
<script type="text/javascript" src="js/prettify.js"></script>
<script type="text/javascript" src="js/lang-css.js"></script>
<!-- html file include script | used for navbar -->
<script src="js/w3data.js"></script>
<script>
w3IncludeHTML();
</script>
<!-- Animations JS -->
<script src="https://unpkg.com/aos@2.3.1/dist/aos.js"></script>
<!-- clipboard.js include -->
<script src="js/clipboard.min.js"></script>
<script>
$(document).ready(function() {
// Add the brand name to the navbar on all sub-pages
// $("#brand-name").html("<h1 class='inline white'><a class='brand-link' href='index.html'>Bootstrap<span class='make-it-mine'>r</span></a></h1>");
// tooltips function
$(function() {
$('[data-toggle="tooltip"]').tooltip()
})
// Add active class to navmenu selection
$("#selectors").addClass("active");
$("#containers-dropdown").addClass("activated");
// If the sample preview input dropdown changes, do this function
$("#selector-1001001").on("change", function() {
// Hide every content div
$(".bootstrapr-selector div").addClass("hidden");
// Get the selected option
var showDiv = $("#selector-1001001").val();
// Unhide the selected option
$(showDiv).removeClass("hidden");
});
// Build the code
$('#build-button').click(function() {
var selectorRando = ~~(Math.random() * 10000000);
var selectorDivOpen = '<div class="bootstrapr-selector">';
var closingDiv = '</div>';
var formOpen = '<form>';
var formClose = '</form>';
var selectorSize = $("#selector-size").val();
var selectOpen = '<select class="form-control' + selectorSize + '" id="selector-' + selectorRando + '"><option disabled="disabled" value="" selected="selected">-- Select --</option>';
var selectClose = '</select>';
var numSections = $("#num-sections").val();
var option = '';
var options = '';
var content = '';
var contents = '';
var openingParagraph = "<p>This is the content for section ";
var closingParagraph = "</p>";
for (i = 0; i < numSections; i++) {
option = '<option value="#content-div-' + (i + 1) + '">Section' + (i + 1) + '</option>';
content = '<div id="content-div-' + (i + 1) + '" class="hidden">' + openingParagraph + (i + 1) + closingParagraph + closingDiv;
if (i == 0 && $('#first-selected').is(':checked')) {
option = '<option value="#content-div-' + (i + 1) + '">Section' + (i + 1) + '</option>';
content = '<div id="content-div-' + (i + 1) + '">' + openingParagraph + (i + 1) + closingParagraph + closingDiv;
} else if (i == 0 && $('#first-selected').is(':checked')) {
option = '<option disabled="disabled" value="" selected="selected"> -- Select -- </option>';
}
options += option;
contents += content;
}
// Write the unique ID to the JS code section
var jsCode = "$('#selector-" + selectorRando + "').on('change', function() {$('.bootstrapr-selector div').addClass('hidden');var showDiv = $('#selector-" + selectorRando +
"').val();$(showDiv).removeClass('hidden');});";
var bsSelector = selectorDivOpen + formOpen + selectOpen + options + selectClose + formClose + contents + closingDiv;
$("#simple-example").html(bsSelector);
$('#simple-code').text(bsSelector);
$('#custom-js-code').text(jsCode);
$('pre').removeClass('prettyprinted');
prettyPrint();
});
// clipboard button
new Clipboard('.btn');
});
</script>
<!-- Confirmation modal -->
<div id="dialog-confirm" title="Reset Form">
<p>This will reset the form. Are you sure?</p>
</div>
<!-- Go to www.addthis.com/dashboard to customize your tools -->
<script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-5e46f4c0e8e8fb44"></script>
</body>
</html>