Skip to content

Commit e8839e1

Browse files
authored
Merge pull request #1050 from Patternslib/rework-navigation
Stabilize and extend pat-navigation incl. URL‌ based markings
2 parents 76a2ebb + 968edca commit e8839e1

File tree

4 files changed

+554
-211
lines changed

4 files changed

+554
-211
lines changed

src/pat/navigation/documentation.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
## Description
22

3-
Marks navigation paths with "in-path" and "current" classes and allows of auto-injecting content when menu item was marked with the "current" class.
3+
Marks navigation paths with "in-path" and "current" classes.
4+
45

56
## Documentation
67

78
The "in-path" and "current" classes and the "item-wrapper" are configurable.
8-
Use the "navigation-load-current" class on the navigation wrapper element to content from menu items marked with the "current" class.
9+
10+
You can automatically load the navigation item marked with the `current` class by adding the class `navigation-load-current` along with `pat-navigation` on the pattern element.
11+
This would invoke a `click` event on the current navigation item and that can be used to load content via `pat-inject`.
912

1013
For examples see index.html.
1114

src/pat/navigation/index.html

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -93,16 +93,33 @@ <h3>Example 2</h3>
9393
<div id="content-tab-2">Example 2 Content will appear here</div>
9494
</section>
9595

96-
<section class="injection_content">
97-
<div id="inject-tab-1">Content for tab 1</div>
98-
99-
<div id="inject-tab-2">Content for tab 2</div>
100-
101-
<div id="inject-tab-1-1">Content for tab 1.1</div>
102-
103-
<div id="inject-tab-1-2">Content for tab 1.2</div>
96+
<section>
97+
<header>
98+
<h3>Example 3 - nested nav, but no injection</h3>
99+
</header>
100+
<ul class="pat-navigation">
101+
<li>
102+
<a href="#10">Tab 1</a>
103+
<ul>
104+
<li>
105+
<a href="#11">Link 1.1</a>
106+
</li>
107+
<li>
108+
<a href="#12">Link 1.2</a>
109+
</li>
110+
</ul>
111+
</li>
112+
<li>
113+
<a href="#2">Tab 2</a>
114+
</li>
115+
</ul>
104116
</section>
105117

118+
<template id="inject-tab-1">Content for tab 1</template>
119+
<template id="inject-tab-2">Content for tab 2</template>
120+
<template id="inject-tab-1-1">Content for tab 1.1</template>
121+
<template id="inject-tab-1-2">Content for tab 1.2</template>
122+
106123
<style>
107124
/* example 1 styles */
108125
a.current {
@@ -140,9 +157,6 @@ <h3>Example 2</h3>
140157
display: inline-block;
141158
vertical-align: top;
142159
}
143-
.injection_content {
144-
display: none;
145-
}
146160
</style>
147161
</body>
148162
</html>

0 commit comments

Comments
 (0)