I’m creating my menu using view along with Bootstrap to create a mega menu style navigation.
I’m having a problem with the nav showing expanded at times when you come to the site and or refresh. not all the time but more than I’d like.
I am using: _menu_link like such:
function MYTHEME_menu_link(array $vars) { if ( $vars['element']['#theme'] == 'menu_link__user_menu' ) { $vars['element']['#attributes']['class'][] = ''; } elseif ( $vars['element']['#theme'] == 'menu_link__main_menu' ) { $vars['element']['#attributes']['class'][] = 'dropdown mm-menu-fw'; $vars['element']['#localized_options']['attributes']['class'][] = 'url-link'; } return theme_menu_link($vars); }
This gives me the following HTML markup.
<ul class="dropdown mm-menu-fw"> <li> <a href="#" class="url-link">MY LINK</a> <ul class="NEED-TO-ADD-CLASS"></ul> </li> </ul>