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') {
setupNav();
}
// 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.