No class available in main menu when submenu is active

lambers's picture
lambers
Sat, 11/04/2017 - 14:03
#1
No class available in main menu when submenu is active

In old Megamenu it was possible to change CSS for item in main menu to show that it is active when a submenu of main menu  is chosen. This was possible with "mm-active" to be specific: .md-style1 .mm-active > a:link,  gives option to change color, underline etc.

In Megamenu 7.x-1.24  the "mm-active"  is changed in " awemenu-active" what i can figure out in theme.inc file.    But unfortunately in standard version with style1 it is not possible to choose this class.  

Please check how i can change css to make clear in main menu what active item when submenu is chosen.

Thxs!

Onno Lambers

cindy's picture
cindy
Sun, 11/05/2017 - 23:19

Hi,

When you active submenu, both tag of submenu and its parent have class 'awemenu-active'

For example, with active submenu 3, then all the 1st, 2nd and 3rd parent tag <li>  have class 'awemenu-active'

If you want to add css for an active certain level, just check its class name at frontend:

For ex, add css for menu item level 1 when active, with style 1 and standard type:

.md-style1.awemenu-standard .awemenu > .awemenu-item.awemenu-active > a{ }

lambers's picture
lambers
Wed, 11/08/2017 - 18:20

Dear Cindy,

Unfortunately this css code is not working.  Please check my website www.a1touchsolution.nl 

If you click on "(Touch)Screens" in main menu,  then you find "(Touch)Screens" activated in page it directs to.

But if you click in "(Touch)Screens" on the submenu "(Touch)computers"  then in the directed page the "(Touch)Screens" is NOT activated.   

Now visitors do not know where they are in menu which is not as it should be.

Please help me to solve this problem.

Thxs!


cindy's picture
cindy
Thu, 11/09/2017 - 00:06

Hi,

Please follow one of the two solutions below:

Solution 1: No need to modify code: Log in admin mode,  insert the absolute url for menu level 1 (url includes https://www.a1touchsolution.nl)

Solution 2: No need to edit link but you have to modify code:

- Find function _md_awemenu_render in file md_megamenu.module

In that function, search:

value = value.replace(hostname + "/","",value);
selector_menu_active.push(value);

- insert the following code under the above code

value = value.replace("=\'","=\'/",value);
selector_menu_active.push(value);
lambers's picture
lambers
Thu, 11/09/2017 - 15:42

Hello Cindy,

Thanks for fast response.   I have chosen solution 2 and works perfect! 

Please can you add code in future versions.  Can also be usefull for other customers.

Thanks again for support!  Case is closed :)

Greetings,

Onno Lambers

cindy's picture
cindy
Thu, 11/09/2017 - 22:07

Sure, 

This will be updated in the next version

Many thanks!

Log in or register to post comments
Have More Idea?

We are here to build your website!

No Universal solution fits all special business requirements. Our experienced team is ready with ideas and state-of-the-art technical solutions to consult the best solution within your budget.