Header Mega Menu
Documentation and examples for Space's powerful, and responsive navigation mega menu.
How it works
Here's what you need to know before getting started with the mega menu:
- Mega menu requires a wrapping
.js-mega-menu
(or any other ID or class which you can replace with) along with.navbar
class. .hs-has-mega-menu
- is a parent class that contains sub-elements within it..hs-mega-menu
- is a child class that contains a container for the mega menu.- Mega menus are responsive by default, but you can easily modify them to change that. Responsive behavior depends on our
hs-megamenu
JavaScript plugin.
How to use?
Copy-paste the stylesheet <link>
into your <head>
to load the CSS.
Copy-paste the following <script>
near the end of your pages under JS Implementing Plugins to enable it.
Copy-paste the following <script>
near the end of your pages under JS Space to enable them.
Copy-paste the init function under JS Plugins Init., before the closing </body>
tag, to enable it.
Columns
You might need to adjust the size width of the mega menu, when using less columns or when the content of the container is less. Use utility classes or use one of the predefined .w-*
classes and apply them next to .hs-mega-menu
class.
Event
Choose opening events from hover
to click
through JavaScript init
and data-event="event"
attribute.
Responsive
Set your collapsing breakpoint to your needs through JavaScript init
. This example collapses the mega menu at 576
breakpoint. Learn more here.
Methods
List of available JavaScript functions.
Attribute | Description | Default value |
---|---|---|
|
Defines the event on which the menu will be displayed. Valid values are:
|
hover |
|
Direction of the menus. Valid values are:
|
horizontal |
|
Determines below what permission the device layout is enabled. | |
|
Revealing effect. To run the script, you must additionally link animate.css All available animation values, can be found here. |
no |
|
Disappearing effect. To run the script, you must additionally link animate.css All available animation values, can be found here. |
no |
|
If true , displays all items from right-to-left (RTL). |
false |
|
Delay of the disappearance of the menu. | 300 |
|
Determines which part of the width of the sidebar will be occupied by a drop-down list. Works only if Works only if direction set to true . |
|
|
Determines relative to what element the drop-down menu will be positioned. Works only if Works only if direction set to true . |
|
|
Defines the class names for the elements of the mega menu. Works only if Works only if direction set to true .
|
|
|
Opening speed of the menu in the mobile layout. | 400 |
|
Determines the smoothness of the animation. Valid values are:
jquery.easing.min.js plugin is required to extend the plugin.
Additional values:
|
linear |