Forum Replies Created

Viewing 1 post (of 1 total)
  • Author
  • in reply to: Dynamically changing bottomToTopSubMenus value #3166

    I found a post on the 0.9.x forums that got me most of the way there and dug through the code to get the rest. Here’s what I ended up doing:

    // Switch the mode of the submenu dropdowns, or instantiate the menu
    // for the first time if it hasn't happened yet.
    function navMode(dropMode) {
    	if (typeof dropMode === 'undefined' || dropMode !== 'dropUp') {
    		dropMode = 'dropDown';
    	// If the nav has not yet been set up, set it up with the default options.
    	if (typeof jQuery('.main-menu__items').data('smartmenus') === 'undefined') {
    	// If the mode is different than the one we passed in, change the option on the fly.
    	// The subOrientation variable is global and contains the current state so we don't do the actions any more often than necessary.
    	if (subOrientation != dropMode) {
    		subOrientation = dropMode;
    		if (dropMode == 'dropUp') {
    			jQuery('.main-menu__items').data('smartmenus').opts.bottomToTopSubMenus = true;
    		} else {
    			jQuery('.main-menu__items').data('smartmenus').opts.bottomToTopSubMenus = false;

    The setupNav() function holds the main initialization function along with as the setup of the menu animations. Now I can use this navMode() function as often as needed since it’s very low-overhead and only does something when it needs to.

Viewing 1 post (of 1 total)


You will be emailed a link to set your password.


Lost password?