← API Index · How to use components
subnavi component #oo-subnavi / .oo-subnavi1
Some designs benefit from an additional sub level navigation placed elsewhere on the page (typically a left column). Features:
- shows the menu level above the level currently shown in the shop component — e.g. when an item is displayed, its parent group is shown together with that group's siblings
- alternatively renders a fixed level of the navigation tree (
oo-subnavi-level) - a "parent link" element (
.oo-subnavi-parentlink) gets the name and link of the parent level - if that menu level does not exist, a placeholder area on the page can be shown instead
- optional hamburger button for responsive designs
There are two ways to mount it:
| Mount | Switch prefix | Notes |
|---|---|---|
<div id="oo-subnavi"> |
oo-subnavi-… |
The single main instance. |
<div class="oo-subnavi1"> |
oo-subnavi1-… |
Can be used several times on one page with different configurations; all instances share the debug scope subnavi1. |
How components are mounted, how switch values are resolved and how debug output is enabled is described in the use-js-components skill.
<div id="oo-navi"></div> <!-- main navigation -->
<div class="nd-container">
<div id="nd-left">
<div id="oo-subnavi"></div> <!-- left bound sub menu -->
<div class="oo-subnavi-empty oo-unused">Shown if the sub menu is empty</div>
</div>
<div id="nd-right">
<div id="oo-shop"></div>
</div>
</div>
component switches
Replace subnavi by subnavi1 in the switch names for the multi-instance variant.
| Switch | Default | Description |
|---|---|---|
oo-shop-page |
– | Page hosting the main shop component. Clicks lead to it; if not provided, the current page is not left. |
oo-subnavi-level |
– | Always start rendering at this level of the navigation tree for the current node (1 = top level entries; 0, the root, is not shown as it would duplicate the main navigation). Makes the menu static — quiet, but less flexible. If not set, the siblings of the current level are shown. Combine with oo-subnavi-numlevels=1 to show exactly one level. |
oo-subnavi-numlevels |
2 |
How many levels to render below the start level: 1, 2 or 3. |
oo-subnavi-onlysubnavi |
true |
false: the sub navigation also lists entries that are items, not only groups. |
oo-subnavi-showtop |
false |
Normally the component renders nothing if that would duplicate the level shown in the shop component. true renders it anyway (one navigation from this component, one from the shop component) — useful if the shop component shows groups as teasers. |
oo-subnavi-private |
false |
true includes the private menu entries (last orders, favourites). Makes sense only with oo-subnavi-level=1, as these are top level entries. |
oo-subnavi-group |
0 |
Show only top level entries of the given groups (comma separated): 0 normal entries (without the "test" flag), 1 test entries, 2 / 3 shop 2 / 3. 0,1 shows all entries regardless of the test flag. See the navi component. |
oo-subnavi-ham |
– | CSS selector of the element that serves as hamburger button to bring up the sub navigation in responsive mode. |
oo-navi-ham-swipe |
true |
false disables closing the hamburger navigation by swiping (shared with the navi component). |
oo-qpnav |
true |
false appends the navigation level to the URL path of the rendered links instead of using a query parameter (needs a rewrite setup). Formerly oo-hashurls. |
Events
| Element | Event | Description |
|---|---|---|
#oo-subnavi |
oo-subnavi-rendered |
Fired once a rendering has finished (oo-subnavi1-rendered for the multi-instance variant). |
When the sub navigation is empty, .oo-subnavi-empty elements on the page are shown (their
oo-unused class is removed) and the <body> gets oo-page-subnavi-empty, otherwise
oo-page-subnavi-notempty.
debug options
Debug scope subnavi (or subnavi1; enable with data-oo-debug="true" on the element or debug:subnavi:all+, see the skill):
| Term | Description |
|---|---|
subnavi:all |
Resolved switches, render input node, level selection, empty-state decisions, clicks. |