TECH Question about Drupal 7 menus

TrenT

OT Supporter
Aug 27, 2002
11,115
NYC
I have set up a basic menu system to go in a left sidebar region on my site. Some of the links are setup in a hierarchy and I have all of them set to show as expanded.

How can I set it up so only the active section is expanded?

For example, I have it like this

-Our Services
--service 1
--service 2
-Expertise
--expertise 1
---subsection of expertise 1
---another subsection of expertise 1
-Industries
-etc..

How do I set it up so all the sections under expertise are hidden unless they click that link? I looked through the CSS of the theme to see if I could alter it that way, and it only adds an 'active' class to the active link rather than the list. Is there a way to do this without having to hide the lists with javascript?

I'm pretty new to to Drupal, if that isn't obvious.
 

White Stormy

Take that, subspace!
Sep 17, 2002
85,544
Sparkopolis
I have set up a basic menu system to go in a left sidebar region on my site. Some of the links are setup in a hierarchy and I have all of them set to show as expanded.

How can I set it up so only the active section is expanded?

For example, I have it like this

-Our Services
--service 1
--service 2
-Expertise
--expertise 1
---subsection of expertise 1
---another subsection of expertise 1
-Industries
-etc..

How do I set it up so all the sections under expertise are hidden unless they click that link? I looked through the CSS of the theme to see if I could alter it that way, and it only adds an 'active' class to the active link rather than the list. Is there a way to do this without having to hide the lists with javascript?

I'm pretty new to to Drupal, if that isn't obvious.

just disable "[always] show as expanded"

what you want is actually the default action
 
TS
TS
TrenT

TrenT

OT Supporter
Aug 27, 2002
11,115
NYC
I would have thought that would be the default way, but its not working that way.

I'm using Danland as a default theme that I am modifying. Would the theme possibly be overriding the default?

Also, I'm using Drupal 7..which may be different. The option in the admin panel says "Show as expanded" with the help text saying " If selected and this link has children, the menu will always appear as expanded."
 
TS
TS
TrenT

TrenT

OT Supporter
Aug 27, 2002
11,115
NYC
Ended up hiding the non-active menus with javascript.. If the user has it disabled then all menus will be expanded, oh well ;o

Code:
jQuery('#sidebar-left ul.menu ul.menu').each(function(){
   if(jQuery(this).find('li a.active').size() == 0){
      jQuery(this).css('display', 'none');
   }
});
jQuery('#sidebar-left ul.menu li a.active').each(function(){
   jQuery(this).parent().find('ul').css('display', 'block');
});
 

Users who are viewing this thread

About Us

  • Please do not post anything that violates any Local, State, Federal or International Laws. Your privacy is protected. You have the right to be forgotten. Site funded by advertising, link monetization and member support.
OT v15.8.1 Copyright © 2000-2022 Offtopic.com
Served by fu.offtopic.com

Online statistics

Members online
216
Guests online
54
Total visitors
270

Forum statistics

Threads
369,746
Messages
16,916,394
Members
86,875
Latest member
ddunn9448