Disable top level menu from being clickable
-
Hi all
I want to be able to disable the top level of a menu from being clickable. So, I want it to do nothing at all if clicked.
I am fully aware of creating a link using a hash, but that does reload the page or go to the top etc.
The exact effect I am looking for is shown on the top level menu in this template demo. I am not looking for template support, although I am not sure if the functionality is available directly in WordPress?
Look at http://armada.dream-demo.com
When hovering over the top level menu items and clicking, nothing at all happens. The links appear to be pointing to ‘pages’ but not ‘#’.
This is the functionality I want to recreate – anyone any ideas?
Many thanks
Mike
-
This jQuery method does actually work (just change
li.page-item-283to the li ID of your choosing), but it does display a rather uglyjavascript:void(0)in the URL, not ideal.Other than the # route, you could just create an empty Custom Link menu item and use that as the parent menu item, it displays nothing in the URL and leads nowhere.
1. Create a Custom Link using # as the URL.
2. Add it to your menu and add sub-menu items to it.
3. Remove the # from the parent menu item.
4. Save menu.Take note of step 3.
Hope this helps.
ThemeSumo. When you are talking about the custom link that is used as a parent menu item – you mean that when it will be implemented when the user will press the button from the top level menu there will be no hashes at all?
I see you fixed your problem? There is in your code
"onclick="return false;"in a href tag, but it can be not a good idea when in somebody’s browser the JS is disabled, so it will be showed like a link..
I think that this issue could be resolved just with the help of<div>I mean remove the<a href>link at all. what do you think about this?Also, I have the additional question considering this topic. Can you help me with the same issue, but convesely? I mean to make the top level menu button available? Nor it shows # but I need to rename it and make active. I’m talking about the “slots by” button on the site http://www.slotozilla.com/ Need to make it like a link that will lead to the page which shows the “slot themes”, but also saves the two other manu items “slot types” and “slot features” active. I’m a newbie in WordPress and development, so will be indebted for help.
Also, @mikelidbetter, please tell me when you’ll resolve you issue, I’m also interested in your results.[moderated to fix broken links. Please put HTML inside “code” delimiters]
The topic ‘Disable top level menu from being clickable’ is closed to new replies.