To achieve sub-menu items expanded by default, you'll need to modify the Navigation layout in Studio Pro.
Steps:
Atlas_Default
) used in your pages.Layout Mode
to Headline
.By doing this, your sub-menu items will be expanded by default when you expand the navigation menu.
I managed to show the items using the following JavaScript:
export async function JS_ExpandAllMenuItems(menuWidgetName, visible) {
// BEGIN USER CODE
// Select all menu items with the class 'mx-navigationtree-has-items' (these have sub-items)
const menuWidget = document.querySelector(`.mx-name-${menuWidgetName}`);
if(menuWidget) {
if(!visible) {
menuWidget.style.display = 'none';
}
}
else {
console.debug('Menu widget not found');
}
// Log to the console for debugging purposes
console.log('Default menu items opened (if applicable).');
// END USER CODE
}