-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsource
117 lines (104 loc) · 2.82 KB
/
source
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
Accordian Menu, show & hide
<!-- HTML -->
<ul id="rightnav" class="rtnav nav">
<li class="sectionhome currentPage">
<div>
<a class="Homelink" href="#" target="">HOME</a>
</div>
</li>
<li class="currentPage">
<a>Heading 1</a>
<ul style="display: none;">
<li>
<a href="#">heading 1.a</a>
</li>
<li>
<a href="#">heading 1.b</a>
</li>
</ul>
</li>
<li class="currentPage">
<a>Heading 2</a>
<ul>
<li>
<a href="#">heading 2.a</a>
</li>
<li>
<a href="#">heading2.b</a>
</li>
</ul>
</li>
<li class="currentPage">
<a>Heading 3</a>
<ul>
<li>
<a href="#">heading 3.a</a>
</li>
<li>
<a href="#">heading 3.b</a>
</li>
<li>
<a href="#">heading 3.c</a>
</li>
<li>
<a href="#">heading 3.d</a>
</li>
</ul>
</li>
</ul>
<style>
/* css for show / hide */
/* the show/ hide is handled by the JS toggle below,
css only sets the begining state, here is hidden */
ul.nav li ul{
display: none;
}
/* insures the active page name list container is open*/
ul.nav li.active ul {
display: block !important;
}
/* if installed on multiple pages, a good example of active page styles, requires JS below */
/* menu formatting based on which page it active */
/* style for the list area */
ul.nav li.active ul.active li.active {
background-color: #ebf0f5 !important;
border-bottom: 1px solid #dcdcdc;
border-top: 2px solid #869bc1;
font-weight: bold;
width: 120%;
position: relative;
left:-21px;
padding-left: 20px;
}
/* style for the list link */
ul.nav li.active ul.active li.active a {
background-color: none !important;
border-bottom: none !important;
box-shadow: none !important;
font-weight: bold;
padding: 6px 0 8px !important;
color: #333;
}
</style>
/* javascript show hide using jquery toggle */
/* jquery library include */
<script src="https://code.jquery.com/jquery-3.2.1.min.js" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" crossorigin="anonymous"></script>
/* toggle changes the display properties (block to hidden) as inline CSS */
<script>
$("ul.nav li a").click(function(){
var nextUl = $(this).next("ul");
$(nextUl).toggle();
});
/* active page recognition */
/* add active class to navigation */
$("ul#rightnav li ul li a").each(function()
{
var path = $(this).attr("href");
if(window.location.pathname.match(path))
{
$(this).parent().addClass("active");
$(this).parents().addClass("active");
$(this).addClass("active");
}
});
</script>