Download & Extend

set default menu tree collapsed

Project:JQuery menu
Version:6.x-2.3
Component:Code
Category:feature request
Priority:normal
Assigned:rpadua
Status:closed (fixed)

Issue Summary

Hi,

I'm newbie to JQuery, everything is working fine but I'd like to set the default tree to collapsed, how can i do that?

Thanks

Comments

#1

if you look in the jquery menu folder, you will find the jquerymeny.module file. Change lines 207 and 208 to closed.

#2

Thanks!! it works like a charm!

Although, is it possible to close an opened branch when you open a new one instead of keeping all opened?

Best xx

#3

The Module is excellent. I'm using it in one of my sites and I needed it to open only if the page was in the active trail.

The result is a very intuitive navigation. I'm using 6.x-3.0 and think the change would be a good adition to the core module.

Here is the Code (Starting in line 219 from jquerymenu.module):

// If the menu item is expanded or in the active trail and if has children add the "open" class.
if (!empty($item['link']['expanded']) || ((in_array($item['link']['href'], $url_array) || ($_GET['q'] == $item['link']['href'])) && !empty($item['link']['has_children']) && !empty($nextlevel))) {
if(in_array($item['link']['href'], $url_array)){
$classes[] = 'open';
$state = 'open';
}
else{
$classes[] = 'closed';
$state = 'closed';
}

}
elseif (!empty($item['below']) && !empty($nextlevel)) {
$classes[] = 'open';
$state = 'open';
}

I hope you find it interesting.
Regards,
Matías

#4

I tried the code you provided, but it expands everything in the tree below the top level branch once you go to one of its branches. Is there a way to leave the non-active branches collapsed?

#5

if you look in the jquery menu folder, you will find the jquerymeny.module file. Change lines 207 and 208 to closed.

Hacking the module isn't the nicest solution. Can't this setting be provided to the settings page?

Hm, checking the file I just noticed that line 209 reads $state = 'closed';. But my top menu item that links to the frontpage is always expanded..

#6

I just noticed that my problem is caused because the front page is always in active trail. But why? Here it is said that <front> is selected, when active trail is empty: http://drupal.org/node/801270

#7

Status:active» closed (fixed)

Not using this module, so no longer need this open.

nobody click here