-
Notifications
You must be signed in to change notification settings - Fork 46
/
components_navbar.html
558 lines (492 loc) · 21.2 KB
/
components_navbar.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
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
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
---
layout: admin
title: Components - Navbar
section: components
module: components_navbar
header:
icon: vertical_align_top
title: Navbar
description: The navbar is fully contained by an HTML5 Nav tag. Inside a recommended container div, there are 2 main parts of the navbar. A logo or brand link, and the navigations links. You can align these links to the left or right.
---
<section id="components_navbar">
<!-- ################### -->
<!-- Right Aligned Links -->
<!-- ################### -->
<div class="row">
<div class="col s12">
<h4 class="main-text lighten-1">Right Aligned Links</h4>
<p>To right align your navbar links, just add a <code class="language-markup">right</code> class to your <code class="language-markup"><ul></code> that contains them.</p>
<nav>
<div class="col s12">
<div class="nav-wrapper">
<a href="index.html" class="brand-logo">Logo</a>
<ul class="right hide-on-med-and-down">
<li><a href="css_color.html">CSS</a></li>
<li><a href="components_badges.html">Components</a></li>
<li><a href="js_collapsible.html">Javascript</a></li>
</ul>
</div>
</div>
</nav>
<pre>
<code class="language-markup">
<nav>
<div class="nav-wrapper">
<a href="#" class="brand-logo">Logo</a>
<ul id="nav-mobile" class="right hide-on-med-and-down">
<li><a href="css_color.html">CSS</a></li>
<li><a href="components_badges.html">Components</a></li>
<li><a href="js_collapsible.html">Javascript</a></li>
</ul>
</div>
</nav>
</code>
</pre>
</div>
</div>
<!-- ################### -->
<!-- Left Aligned Links -->
<!-- ################### -->
<div class="row">
<div class="col s12">
<h4 class="main-text lighten-1">Left Aligned Links</h4>
<p>To left align your navbar links, just add a <code class="language-markup">left</code> class to your <code class="language-markup"><ul></code> that contains them.</p>
<nav>
<div class="col s12">
<div class="nav-wrapper">
<a href="index.html" class="brand-logo right">Logo</a>
<ul class="left hide-on-med-and-down">
<li><a href="css_color.html">CSS</a></li>
<li><a href="components_badges.html">Components</a></li>
<li><a href="js_collapsible.html">Javascript</a></li>
</ul>
</div>
</div>
</nav>
<pre>
<code class="language-markup">
<nav>
<div class="nav-wrapper">
<a href="#" class="brand-logo right">Logo</a>
<ul id="nav-mobile" class="left hide-on-med-and-down">
<li><a href="css_color.html">CSS</a></li>
<li><a href="components_badges.html">Components</a></li>
<li><a href="js_collapsible.html">Javascript</a></li>
</ul>
</div>
</nav>
</code>
</pre>
</div>
</div>
<!-- ################## -->
<!-- Centering the logo -->
<!-- ################## -->
<div class="row">
<div class="col s12">
<h4 class="main-text lighten-1">Centering the logo</h4>
<p>The logo will center itself on medium and down screens, but if you want the logo to always be centered, add the <code class="language-markup">center</code> class to your <code class="language-markup"><a class="brand-logo"></code>. You will have to make sure yourself that links do not overlap if you use this.</p>
<nav>
<div class="col s12">
<div class="nav-wrapper">
<a href="index.html" class="brand-logo center">Logo</a>
<ul class="left hide-on-med-and-down">
<li><a href="css_color.html">CSS</a></li>
<li><a href="components_badges.html">Components</a></li>
</ul>
</div>
</div>
</nav>
<pre>
<code class="language-markup">
<nav>
<div class="nav-wrapper">
<a href="#" class="brand-logo center">Logo</a>
<ul id="nav-mobile" class="left hide-on-med-and-down">
<li><a href="css_color.html">CSS</a></li>
<li><a href="components_badges.html">Components</a></li>
<li><a href="js_collapsible.html">Javascript</a></li>
</ul>
</div>
</nav>
</code>
</pre>
</div>
</div>
<!-- ############ -->
<!-- Active Items -->
<!-- ############ -->
<div class="row">
<div class="col s12">
<h4 class="main-text lighten-1">Active Items</h4>
<p>
Add active class to your li tags to denote the current page.
</p>
<nav>
<div class="col s12">
<div class="nav-wrapper">
<a href="index.html" class="brand-logo center">Logo</a>
<ul class="left hide-on-med-and-down">
<li><a href="css_color.html">CSS</a></li>
<li><a href="components_badges.html">Components</a></li>
<li class="active"><a href="js_collapsible.html">Javascript</a></li>
</ul>
</div>
</div>
</nav>
<pre>
<code class="language-markup">
<nav>
<div class="nav-wrapper">
<a href="index.html" class="brand-logo">Logo</a>
<ul class="right hide-on-med-and-down">
<li><a href="css_color.html">CSS</a></li>
<li><a href="components_badges.html">Components</a></li>
<li class="active"><a href="js_collapsible.html">Javascript</a></li>
</ul>
</div>
</nav>
</code>
</pre>
</div>
</div>
<!-- ######################### -->
<!-- Extended Navbar with Tabs -->
<!-- ######################### -->
<div class="row">
<div class="col s12">
<h4 class="main-text lighten-1">Extended Navbar with Tabs</h4>
<p>To add extended components to the navbar, add the class <code class="language-markup">extended-nav</code> to the outer nav tag. This will allow your navbar height to be variable. Then you can just include a tabs component inside the nav-wrapper.</p>
<nav class="nav-extended">
<div class="nav-wrapper">
<a href="#" class="brand-logo">Logo</a>
<a href="#" data-activates="mobile-demo" class="button-collapse"><i class="material-icons">menu</i></a>
<ul id="nav-mobile" class="right hide-on-med-and-down">
<li><a href="sass.html">Sass</a></li>
<li><a href="badges.html">Components</a></li>
<li><a href="collapsible.html">JavaScript</a></li>
</ul>
<ul class="side-nav" id="mobile-demo">
<li><a href="sass.html">Sass</a></li>
<li><a href="badges.html">Components</a></li>
<li><a href="collapsible.html">JavaScript</a></li>
</ul>
<ul class="tabs">
<li class="tab"><a href="#test1">Test 1</a></li>
<li class="tab"><a class="active" href="#test2">Test 2</a></li>
<li class="tab disabled"><a href="#test3">Disabled Tab</a></li>
<li class="tab"><a href="#test4">Test 4</a></li>
</ul>
</div>
</nav>
<br>
<div id="test1" class="col s12">Test 1</div>
<div id="test2" class="col s12">Test 2</div>
<div id="test3" class="col s12">Test 3</div>
<div id="test4" class="col s12">Test 4</div>
<br>
<pre>
<code class="language-markup">
<nav class="nav-extended">
<div class="nav-wrapper">
<a href="#" class="brand-logo">Logo</a>
<a href="#" data-activates="mobile-demo" class="button-collapse"><i class="material-icons">menu</i></a>
<ul id="nav-mobile" class="right hide-on-med-and-down">
<li><a href="sass.html">Sass</a></li>
<li><a href="badges.html">Components</a></li>
<li><a href="collapsible.html">JavaScript</a></li>
</ul>
<ul class="side-nav" id="mobile-demo">
<li><a href="sass.html">Sass</a></li>
<li><a href="badges.html">Components</a></li>
<li><a href="collapsible.html">JavaScript</a></li>
</ul>
<ul class="tabs">
<li class="tab"><a href="#test1">Test 1</a></li>
<li class="tab"><a class="active" href="#test2">Test 2</a></li>
<li class="tab disabled"><a href="#test3">Disabled Tab</a></li>
<li class="tab"><a href="#test4">Test 4</a></li>
</ul>
</div>
</nav>
<div id="test1" class="col s12">Test 1</div>
<div id="test2" class="col s12">Test 2</div>
<div id="test3" class="col s12">Test 3</div>
<div id="test4" class="col s12">Test 4</div>
</code>
</pre>
</div>
</div>
<!-- ############ -->
<!-- Fixed Navbar -->
<!-- ############ -->
<div class="row">
<div class="col s12">
<h4 class="main-text lighten-1">Fixed Navbar</h4>
<p>To make the navbar fixed, you have to add an outer wrapping div with the class <code class="language-markup">navbar-fixed</code>. This will offset your other content while making your nav fixed. You can adjust the height of this outer div to change how much offset is on your content.</p>
<pre>
<code class="language-markup">
<div class="navbar-fixed">
<nav>
<div class="nav-wrapper">
<a href="index.html" class="brand-logo">Logo</a>
<ul class="right hide-on-med-and-down">
<li><a href="css_color.html">CSS</a></li>
<li><a href="components_badges.html">Components</a></li>
</ul>
</div>
</nav>
</div>
</code>
</pre>
</div>
</div>
<!-- #################### -->
<!-- Navbar Dropdown Menu -->
<!-- #################### -->
<div class="row">
<div class="col s12">
<h4 class="main-text lighten-1">Navbar Dropdown Menu</h4>
<p>To add a navbar dropdown menu, add the <code class="language-markup">ul</code> dropdown structure into the page. Then, add an element to trigger the dropdown menu. Make sure to supply the id of the dropdown structure to the <code class="language-markup">data-activates</code> attribute of the dropdown trigger.</p>
<ul id="dropdown1" class="dropdown-content">
<li><a href="index.html">one</a></li>
<li><a href="index.html">two</a></li>
<li class="divider"></li>
<li><a href="index.html">three</a></li>
</ul>
<nav>
<div class="col s12">
<div class="nav-wrapper">
<a href="index.html" class="brand-logo">Logo</a>
<ul class="right hide-on-med-and-down">
<li><a href="css_color.html">CSS</a></li>
<li><a href="components_badges.html">Components</a></li>
<li><a class="dropdown-button" href="index.html" data-activates="dropdown1">Dropdown<i class="material-icons dropdown-icon right">arrow_drop_down</i></a></li>
</ul>
</div>
</div>
</nav>
<pre>
<code class="language-markup">
<!-- Dropdown Structure -->
<ul id="dropdown1" class="dropdown-content">
<li><a href="index.html">one</a></li>
<li><a href="index.html">two</a></li>
<li class="divider"></li>
<li><a href="index.html">three</a></li>
</ul>
<nav>
<div class="nav-wrapper">
<a href="index.html" class="brand-logo">Logo</a>
<ul class="right hide-on-med-and-down">
<li><a href="css_color.html">CSS</a></li>
<li><a href="components_badges.html">Components</a></li>
<!-- Dropdown Trigger -->
<li><a class="dropdown-button" href="index.html" data-activates="dropdown1">Dropdown<i class="material-icons dropdown-icon right">arrow_drop_down</i></i></a></li>
</ul>
</div>
</nav>
</code>
</pre>
<p>To activate the dropdown menu, insert this line of code into your JavaScript file, within the <code class="language-javascript">$( document ).ready(function)</code> block</p>
<pre>
<code class="language-javascript">
$(".dropdown-button").dropdown();
</code>
</pre>
<h5 class="margin-top-35">Trigger dropdown menu on click</h5>
<p>By default, the dropdown menu is activated by hovering over the dropdown trigger. To activate the dropdown menu on click, pass <code class="language-javascript">{ hover: false }</code> into the above <code class="language-javascript">dropdown()</code> function</p>
</div>
</div>
<!-- ########## -->
<!-- Icon Links -->
<!-- ########## -->
<div class="row">
<div class="col s12">
<h4 class="main-text lighten-1">Icon Links</h4>
<nav>
<div class="col s12">
<div class="nav-wrapper">
<a href="index.html" class="brand-logo">Logo</a>
<ul class="right hide-on-med-and-down">
<li><a href="sass.html"><i class="material-icons">search</i></a></li>
<li><a href="badges.html"><i class="material-icons">view_module</i></a></li>
<li><a href="collapsible.html"><i class="material-icons">refresh</i></a></li>
<li><a href="mobile.html"><i class="material-icons">more_vert</i></a></li>
</ul>
</div>
</div>
</nav>
<p>You can add icons into links. For icon only links you don't need any additional class. Just pop the <code class="language-markup">i</code> tag in and it will work.</p>
<pre>
<code class="language-markup">
<nav>
<div class="nav-wrapper">
<a href="index.html" class="brand-logo">Logo</a>
<ul class="right hide-on-med-and-down">
<li><a href="sass.html"><i class="material-icons">search</i></a></li>
<li><a href="badges.html"><i class="material-icons">view_module</i></a></li>
<li><a href="collapsible.html"><i class="material-icons">refresh</i></a></li>
<li><a href="mobile.html"><i class="material-icons">more_vert</i></a></li>
</ul>
</div>
</nav>
</code>
</pre>
<nav>
<div class="col s12">
<div class="nav-wrapper">
<a href="index.html" class="brand-logo">Logo</a>
<ul class="right hide-on-med-and-down">
<li><a href="sass.html"><i class="material-icons left">search</i>Link with Left Icon</a></li>
<li><a href="badges.html"><i class="material-icons right">view_module</i></i>Link with Right Icon</a></li>
</ul>
</div>
</div>
</nav>
<p>For adding an icon to a text link you need to add either a <code class="language-markup">left</code> or <code class="language-markup">right</code> class to the icon depending on where you want the icon to be.</p>
<pre>
<code class="language-markup">
<nav>
<div class="nav-wrapper">
<a href="index.html" class="brand-logo">Logo</a>
<ul class="right hide-on-med-and-down">
<li><a href="sass.html"><i class="material-icons left">search</i>Link with Left Icon</a></li>
<li><a href="badges.html"><i class="material-icons right">view_module</i></i>Link with Right Icon</a></li>
</ul>
</div>
</nav>
</code>
</pre>
</div>
</div>
<!-- ####### -->
<!-- Buttons -->
<!-- ####### -->
<div class="row">
<div class="col s12">
<h4 class="main-text lighten-1">Buttons</h4>
<nav>
<div class="col s12">
<div class="nav-wrapper">
<a href="index.html" class="brand-logo">Logo</a>
<ul class="right hide-on-med-and-down">
<li><a>A link</a></li>
<li><a class="waves-effect waves-light btn">A button</a></li>
<li><a class="waves-effect waves-light btn-large">A large button</a></li>
</ul>
</div>
</div>
</nav>
<p>You can add buttons into links. For buttons you don't need any additional class. Just pop the <code class="language-markup">.btn</code> class on the <code class="language-markup">a</code> tag.</p>
<pre>
<code class="language-markup">
<nav>
<div class="nav-wrapper">
<a href="index.html" class="brand-logo">Logo</a>
<ul class="right hide-on-med-and-down">
<li><a href="#">A link</a></li>
<li><a class="waves-effect waves-light btn">A button</a></li>
<li><a class="waves-effect waves-light btn-large">A large button</a></li>
</ul>
</div>
</nav>
</code>
</pre>
</div>
</div>
<!-- ########## -->
<!-- Search Bar -->
<!-- ########## -->
<div class="row">
<div class="col s12">
<h4 class="main-text lighten-1">Search Bar</h4>
<nav>
<div class="nav-wrapper">
<form>
<div class="input-field">
<input id="search-example" type="search" required>
<label for="search"><i class="material-icons">search</i></label>
<i class="material-icons">close</i>
</div>
</form>
</div>
</nav>
<pre>
<code class="language-markup">
<nav>
<div class="nav-wrapper">
<form>
<div class="input-field">
<input id="search" type="search" required>
<label for="search"><i class="material-icons">search</i></label>
<i class="material-icons">close</i>
</div>
</form>
</div>
</nav>
</code>
</pre>
</div>
</div>
<!-- ###################### -->
<!-- Mobile Collapse Button -->
<!-- ###################### -->
<div class="row">
<div class="col s12">
<h4 class="main-text lighten-1">Mobile Collapse Button</h4>
<nav>
<div class="col s12">
<div class="nav-wrapper">
<a href="index.html" class="brand-logo">Logo</a>
<a href="#" data-activates="mobile-demo" class="button-collapse"><i class="material-icons">menu</i></a>
<ul class="right hide-on-med-and-down">
<li><a href="index.html">Dashboard</a></li>
<li><a href="css_color.html">CSS</a></li>
<li><a href="components_badges.html">Components</a></li>
<li><a href="js_collapsible.html">Javascript</a></li>
<li><a class="btn waves-effect waves-light" href="components_buttons.html">Buttons</a></li>
</ul>
<ul class="side-nav" id="mobile-demo">
<li><a href="index.html">Dashboard</a></li>
<li><a href="css_color.html">CSS</a></li>
<li><a href="components_badges.html">Components</a></li>
<li><a href="js_collapsible.html">Javascript</a></li>
<li><a class="btn waves-effect waves-light" href="components_buttons.html">Buttons</a></li>
</ul>
</div>
</div>
</nav>
<p>When your nav bar is resized, you will see that the links on the right turn into a hamburger icon <i class="material-icons">menu</i>. Take a look at the example below to get this functionality. Add the entire <code class="language-markup">button-collapse</code> line to your <code class="language-markup">nav</code>.</p>
<pre>
<code class="language-markup">
<nav>
<div class="nav-wrapper">
<a href="index.html" class="brand-logo">Logo</a>
<a href="#" data-activates="mobile-demo" class="button-collapse"><i class="material-icons">menu</i></i></a>
<ul class="right hide-on-med-and-down">
<li><a href="index.html">Dashboard</a></li>
<li><a href="css_color.html">CSS</a></li>
<li><a href="components_badges.html">Components</a></li>
<li><a href="js_collapsible.html">Javascript</a></li>
</ul>
<ul class="side-nav" id="mobile-demo">
<li><a href="index.html">Dashboard</a></li>
<li><a href="css_color.html">CSS</a></li>
<li><a href="components_badges.html">Components</a></li>
<li><a href="js_collapsible.html">Javascript</a></li>
</ul>
</div>
</nav>
</code>
</pre>
<h5 class="margin-top-35">Initialization</h5>
<p>After including the button-collapse line into your navbar, all you have to do now is place this code in your page's <code class="language-javascript">$( document ).ready(function(){})</code> code. This example below assumes you have not modified the classes in the above example. In the case that you have, just change the jQuery selector in the line below to match it.</p>
<pre>
<code class="language-javascript">
$(".button-collapse").sideNav();
</code>
</pre>
</div>
</div>
</section>