An accessible navigation component to help create a masthead.
The responsive navigation component is a normal horizontal navigation on large screen, and collapses down to an off-canvas model on small viewports. The default HTML should work within the confines of WordPress, but some modifications may have to be implemented for your specific use case. No jQuery is required.
* Standalone JS is used on projects that are not set up to handle
ES6. To use this version you will need to download the compiled
JavaScript from the component's dist directory and pull it into your
project. The same process should be
followed with the CSS if it cannot process through the NPM package.
Documentation
Installation
This component accepts two arguments, the selector for the navigation container and an object containing configuration settings and optional callbacks.
npm install @10up/component-navigation --save
Options
List of Options for this component
action
The action to use to open menu items (default) hover
Callbacks
List of Callbacks for this component
onCreate
Called after the component is initialized on page load
onOpen
Called when a menu item is opened
onClose
Called when a menu item is closed
onSubmenuOpen
Called when a submenu item is opened
onSubmenuClose
Called when a submenu item is closed
Classes
List of Classes used for this component
.site-navigation
Wrapping class for the component.
.primary-menu
The navigation menu itself, also the target for the method call.