← API Index · How to use components
navi component #oo-navi
This component renders the main navigation for the shop related menu tree. All data related menu items (and a few more) come from the warehouse, as opposed to menu entries of a site navigation or CMS.
Features:
- shows the top level menu entries
- can show the second (and third) menu level, depending on the design as a layer or a permanent pane
- highlights the current navigation status
- optional hamburger navigation for responsive designs, with swipe-to-close
- optionally includes the private navigation entries (favourites, last orders)
- controls
.oo-navi-head/.oo-navi-imageelements anywhere on the page (name and image of the current top level entry)
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" data-oo-shop-page="shop.html" data-oo-navi-numlevels="3"></div>
component switches
Data and pages
| 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-navi-group |
0,1,2,3 |
Show only top level entries of the given groups (comma separated): 0 normal navigation (entries without the "test" flag), 1 test entries, 2 "shop 2", 3 "shop 3". The default allows everything the server returns — server side restrictions may still apply. |
oo-navi-numlevels |
2 |
How many navigation levels to render: 1, 2 or 3. The component always starts at the top of the navigation tree. The fewer levels, the less data is fetched. |
oo-navi-private |
false |
true shows the private navigation entries (favourites, last orders) as part of the navigation. |
oo-navi-headlevel |
1 |
Which navigation level feeds the page-wide .oo-navi-head and .oo-navi-image elements. The topmost level is 1. Should no element exist at the requested level, the next available one is used. |
oo-navi-image-pi-size |
0 |
Image size advice for the navigation header images: a pixel value (square) or w,h[,bg]. 0 means no scaling. |
oo-qpnav |
true |
true hands the navigation level over as a query parameter; false appends it to the URL path instead (needs a rewrite setup). Formerly oo-hashurls. |
oo-navi-ss |
false |
true uses the navigation pre-rendered by the server instead of rendering it client side. Read oo-navi-numlevels and oo-navi-group from the element's data- attributes in that mode. |
Click and hover behaviour
| Switch | Default | Description |
|---|---|---|
oo-navi-omit-group |
false |
true: a click on a navigation point jumps directly to its first subgroup (if any) — useful with a left column navigation. A number behaves like true except for the navigation entry with that id. |
oo-navi-dontopen2ndlevel |
false |
true: a click on a main navigation point only navigates, it doesn't open the second level (for designs that implement their own logic). Also disables hovering. |
oo-hover |
false |
true: second level panes open on hover; false: on click. A pixel value is a breakpoint: windows wider than that hover, smaller ones click (evaluated once at load time). Hovering is off anyway with one level or oo-navi-dontopen2ndlevel. |
oo-navi-3rdlevel-hover |
false |
true (with 3 levels): the third level opens only when hovering over its second level parent. |
oo-autoclose |
true |
false: open second level panes don't close automatically when another one opens. |
oo-defer |
– | off prevents rendering of the navigation while still loading the component's functionality (e.g. for timing or design reasons). |
Hamburger navigation
| Switch | Default | Description |
|---|---|---|
oo-navi-ham |
– | CSS selector of the element that serves as hamburger button to bring up the navigation in responsive mode. |
oo-navi-ham-swipe |
true |
false disables closing the hamburger navigation by swiping. |
oo-navi-ham-closebutton |
!oo-navi-ham-swipe |
true shows a close button (#oo-navi-ham-close-btn) in the hamburger navigation; on by default when swiping is disabled. |
External control
A navigation level switch can be triggered from your own JavaScript; all components on the page follow:
if (oojq) oojq("#oo-navi").trigger("oo-setml", {entity: 'Group', entityId: '8'});
(oojq denotes the shop's jQuery instance, available also in the init phase.)
debug options
Debug scope navi (enable with data-oo-debug="true" on the element or debug:navi:<term>+, see the skill):
| Term | Description |
|---|---|
navi:all |
General debug output (resolved switches, click targets, jump-to-subgroup decisions). |
navi:events |
Opening / closing of level panes and incoming events. |
navi:p |
Rendering profile: timing of the rendering steps. |
navi:hoo |
Hover decisions (oo-hover evaluation per event). |