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
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
Comment #1
pwaterz commentedif you look in the jquery menu folder, you will find the jquerymeny.module file. Change lines 207 and 208 to closed.
Comment #2
rpadua commentedThanks!! 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
Comment #3
mokeefe commentedThe 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
Comment #4
jlea9378 commentedI 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?
Comment #5
yan commentedHacking 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..Comment #6
yan commentedI 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/801270Comment #7
jlea9378 commentedNot using this module, so no longer need this open.
Comment #8
hockey2112 commentedI have the same need. In jquerymenu.module (starting at line 267), I changed this:
to this:
But it had no effect. What I need is to have the menu always be closed, even if the current page is in the active trail. Any help?
Thanks!
Comment #9
chris mcgrath commentedsubscribing in need of the same behavior need menu to not be expanded on new page load
Comment #10
Bhuvana_Indukuri commentedNeed the same behaviour for drupal 7 version of the module
Comment #11
rituraj.gupta commentedComment the starting 4 lines of jquerymenu.js for drupal 7
$('ul.jquerymenu .open').parents('li').removeClass('closed').addClass('open');
$('ul.jquerymenu .open').parents('li').children('span.parent').removeClass('closed').addClass('open').slideDown('700');
$('ul.jquerymenu .active').parents('li').removeClass('closed').addClass('open');
$('ul.jquerymenu .active').parents('li').children('span.parent').removeClass('closed').addClass('open');
Hope this help. :)