Site logo

Archived topic

Possible to build this kind of mega menu with the gp simple mega menu

30 replies · Started by Benny on March 22, 2023

Viewing posts 1–15 of 31

Hey there, is it possible to build a mega menu (with the simple mega menu from the docs), where one could hover over the parent links and everytime there are other sub-"links"? I attach an image, so that you get what i mean. Thank you!

https://ibb.co/4ZgSmrj

Hi there,

i don't fully understand.
In the image there is three columns. Do you mean if you hover on items in the left column it shows its submenus in the middle column and so on?

Thanks for the quick reply.

I meant, if one hovers on the links in the header, that the menu changes its submenu items.

I don't fully understand either, can you link us to the example site?

I have a figma layout and have to build it myself.

There is just the header bar with several linked sites, where i can hover over and the menu appears but shows different linked sub-sites according to the parent-site / topic.

In the sample implementation there is just one linked site where the menu unfolds. The other pages are normaly linked and and can be clicked.

Maybe i need just more mega menus in the header bar?

I will find an example how this works on other pages, maybe this shows it better.

I'm sorry but I really don't understand what you mean.

Can you link us to the example site and tell us the steps to see what you mean?

Let me know!

Here we go. Every parent link has a different submenu --> https://dynamics.microsoft.com/de-de/

I would rather use hover instead of click action but this is close to the menu i want to build.

Thank you for your effort!

The Simple Mega Menu CSS will do something very similar to that, you can apply it to as many menu items as you like. And it will work by default on Hover.

In your original image though there was other types of content in the sub menu eg. blue contact box. Is that a requirement ?

Yep, but i thought i could maybe hook it into the submenu easily?

I appreciate your help and patience very much!

You would do something like this:

1. Make the mega-menu submenu a flex container and justify the content center:

.mega-menu .sub-menu {
    display: flex;
    justify-content: center;
}

2. Create a CSS Rule for the mega menu columns eg. mega-menu-col-3
And set the individual Columns width eg. 400px. So the total 3 column width will be 1200px.


.mega-menu-col-3 .sub-menu li {
    max-width: 400px;
}

Repeat that logic for the other column settings you use

Problem is, i have 3 columns but not always and it should be aligned with the logo. Isnt it possible to build it entirely with generateblocks (wouldnt be a huge problem then).

The hook you posted above isnt working either (or i did something wrong).

Ah apologies, that GIST was part of a larger project. I have just updated it so it can be used in isolation.
I have updated the last comment. One minor change is the use of _ vs - before the item slug

Ah i see. Will try tomorrow. Would it be possible to hook the entire submenu in with this? So maybe one hovers over a menu item and in the appearing mega menu everything is built with generateblocks. So i could set the inner with etc.

This archived topic is closed to new replies.