Hello.

Let's say that I have a following menu:

  • A
    • A1
    • A2
  • B

Which looks like this.

When somebody clicks on the arrow on the right of A (or in the empty space on the left of the arrow) the submenu expands, but when they click on A it redirects to the page set in admin/structure/menu/item/785/edit.

I want A to also expand the submenu instead of redirecting. How do I achieve that in Drupal 7?

I've tried using this module but despite setting option "Disable clicks" in parent menu items they still redirect me to their page.
I don't mind a solution which involves programming, not only installing modules and using the interface.

Comments

mansigajjar’s picture

Hello,

Please find following link it might be help you:
https://www.drupal.org/node/143322

Or you can assign http://# or this http://#anchorname in path.

mrjigsaw’s picture

Neither of the solution worked.

When I used http://# as URL it redirected me to about:blank in Chrome.
Pasting mentioned code and changing YOURTHEMENAME to my theme name did nothing. I've cleared caches after I added the code and nothing changed.

mrjigsaw’s picture

Neither of the solution worked.

When I used http://# as URL it redirected me to about:blank in Chrome.
Pasting mentioned code and changing YOURTHEMENAME to my theme name did nothing. I've cleared caches after I added the code and nothing changed.

mansigajjar’s picture

Hello,

Please try with thishttp:#. It's work for me.

mrjigsaw’s picture

http:# indeed makes the link non-clickable. But what I wanted was for the menu parent item to expand and show its children.
It's better than it was, so thank you, but my issue is still not resolved.

mansigajjar’s picture

Hello,

Try with Superfish module.

mrjigsaw’s picture

But I don't want to create a new menu. I don't want a module which will make another type of menu - I want to alter the existing one.
It must be possible to edit the existing menu to be able to expand parent menu items.
But I'm still grateful for you sharing your time with me.

mansigajjar’s picture

Hello,

By using css or js you can do this.

mrjigsaw’s picture

I guess so but I don't know how.
Menu items doesn't have IDs or classes and even if they did I wouldn't know what to do in the onclick function.

dev18.addweb’s picture

Use module Void Menu to generate menu items without links. Also check "Show as expanded" checkbox for parent link from menu edit page. Now when you click on the parent it will not redirect & only open dropdown.

Thanks!

dev18.addweb’s picture

Use module Void Menu to generate menu items without links. Also check "Show as expanded" checkbox for parent link from menu edit page. Now when you click on the parent it will not redirect & only open dropdown.

Thanks!