Site logo

Archived topic

Sider top menu collapsed by default

1 reply · Started by Adam on July 11, 2021

Viewing posts 1–2 of 2

Hi Adam,

You can use Tom's script here - https://generatepress.com/forums/topic/expand-submenus-on-mobile-with-ability-to-close-each-one-again/#post-1298611 - but modify the selectors.

The script originally was written for all submenu items but we can change that to target a specific one through its menu id.

Each menu item has a unique menu ID, we can use that as a selector.

Example:

<script>
    jQuery( document ).ready( function( $ ) {
        $( '#menu-item-19262.menu-item-has-children .sub-menu' ).addClass( 'toggled-on' );
        $( '#menu-item-19262.menu-item-has-children' ).addClass( 'sfHover' );
    } );
</script>

Where menu-item-19262 is the id of the menu item element.

This archived topic is closed to new replies.