Archived topic
menu doesn't work with custom links removing #
21 replies · Started by Yohann on November 19, 2022
In the Menu builder you can add Classes to the menu items - see here:
https://docs.generatepress.com/article/using-the-wordpress-menu-builder/#custom-classes
Add a class to the ones you want to target eg. obfuscated
It will add the class to the menu-item li. So you can then use it in my CSS like so:
.menu-item-has-children.obfuscated a:not([href]) {
pointer-events: none;
position: relative;
}
.menu-item-has-children.obfuscated a:not([href]) .dropdown-menu-toggle {
pointer-events: auto;
cursor: pointer;
position: absolute;
left: 0;
right:0;
text-align: right;
}
Hello I am sorry but I think I am not clear enough
When I use generatepress menu, if I remove the # in custom links, the menu immediately close.
So it is not a trouble of any plugin, but a trouble in the theme. I have this even when I remove the obfuscation plugin.
The trouble is #/no#
So the only thing to do, is to try to correct this in generate press.
The solution you gave me doesn't work.
Do you have an idea or I forget...
Thank you
When I use generatepress menu, if I remove the # in custom links, the menu immediately close.
This i cannot replicate. Where can i see this ?
You can see it on all the links of the menu
For example when you click on PARAÎTRE PLUS JEUNE on first line … you will see that it doesn’t open the submenu but close immediately all the off Canva menu
Hi Yohann,
The menu item PARAÎTRE PLUS JEUNE link is not a simple #but something else as you can see in the below screenshot, how did you add the menu item?
https://www.screencast.com/t/u5wuu8Ecipyu
And for other parent menu items, none of them has "#" as a link, but I tried in the developer tool and they all worked as expected.
Hello, to simplify I have created a new test menu
You have TEST TIRE # and NO#
When it is NO#, I have removed the #.
Than you will see that it doesn't work.
If we use the last CSS you gave me, the submenu links don't work.
So the easiest thing to do, is to correct the automatic closing menu, when we remove # on custom links.
Is it more comprehensive ?