Set selected

To make a menu item appear "selected" onMouseOver or when opening its subpanel, use the setSelected options and configuration.

<script>
    document.addEventListener(
        "DOMContentLoaded", () => {
            new Mmenu( "#menu", {
                setSelected: {
                    // set selected options
                }
            }, {
                setSelected: {
                    // set selected configuration
                }
            });
        }
    );
</script>

Example

Give it a go, change the options below and see how it affects the menu.

<script>
    document.addEventListener(
        "DOMContentLoaded", () => {

        }
    );
</script>

Options for the "setSelected" add-on

Option Datatype Default value Description
setSelected
{
current boolean true Whether or not to make the current menu item appear "selected".
Set to "detect" if you want the current menu item to be automatically found based on the URL.
hover boolean false Whether or not to make menu item appear "selected" onMouseOver.
parent boolean false Whether or not to make menu item appear "selected" while its subpanel is opened.
}

Configuration for the "setSelected" add-on

The "setSelected" add-on has no configuration options.

CSS variables for the "setSelected" add-on

The "setSelected" add-on has no CSS variables.

API methods for the "setSelected" add-on

The "setSelected" add-on has no API methods.