Closed (won't fix)
Project:
JQuery menu
Version:
6.x-2.1
Component:
User interface
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
12 Feb 2009 at 10:19 UTC
Updated:
16 Feb 2010 at 10:16 UTC
Jump to comment: Most recent file
Comments
Comment #1
PixelClever commentedThat sounds like it would take quite a bit of fancy coding and would probably impact performance. If you think about it, you would have to store and enormous array of link identifiers in either a session variable or a cookie. I personally don't think I could do it without slowing down the module drastically.
I am open to patches from the javascript gods if they smile upon us, but I personally am not up for the task.
Comment #2
vik.nowak commentedThis is for my own private use, but the general principle might be the same for your case and I thought I should share this.
This keeps all parent menus open, if there's an active child 'a' element somewhere in there.
this goes into jquerymenu_no_animation.js, but you can figure it out for the other file as well :)
Thank you for this wonderful module.
Comment #3
PixelClever commentedI think I misunderstood the issue in the beginning. There was a php based solution that was very easy to put in. In the 2.3 release active links have their children open on page load.
Comment #4
LarryS commentedYou didn't misunderstand (I think). I meant keeping the state of open/closed menus regardless of whether the current page was an active item within the menu tree.
If you generated unique id attributes for every HTML list item element (don't have any now, could use the term id) and sent the ids of only 'open' menu items to the server as a cookie, then the module could figure the open state of the menu on generation of the menu. You would only have to record, via Javascript, what ids were currently open or have changed state, and store that in a cookie.
I don't think you have to do it all in JavaScript. This method would 'break' if terms were added/deleted recently. The cookie could be reset on page loads to offset this issue.
Well, at least I think it would work.
Comment #5
PixelClever commentedIn that case I understood correctly the first time and comment #2 just confused me. Doing what you are talking about would slow down the module significantly... I'm not adding it unless someone can provide a patch that can be demonstrated to run quickly.
Comment #6
PixelClever commentedThere's no reason you couldn't add the functionality from an add on module. In this situation I think that would be the way to go.
Comment #7
math_1048 commentedThank you very much for module creator,
Dear vik.nowak thank you for your nice code - I was looking for :)
best regards
Comment #8
davidwhthomas commentedI'm also interested in this feature, to preserve open state between reloads without reference to the active trail.
I'm working on a patch and will keep this issue posted.
DT
Comment #9
sven.buschbeck commentedHi All,
The website, I am currently working on, uses two additional menus besides primary links (one called for internal documents and the default Drupal navigation menu). As a side administrator, I have to use both menus simultaneously, thus I really could not live with the situation of clicking one menu makes the other collapse all nodes.
To cut a long story short: I modified Jquerymenu to remember states for each menu after reload by using a cookie.
Unfortunately, I had to modify both ends - PHP (adding an ID to each menu item) and Javascript (to store and recover states).
PHP functions modified (PHP file attached!):
Javascript changes (marked using /* sb patch */ and /* /sb patch */ - original Javascript file including some debug stuff attached)):
In the website version, I additionally quoted the first section (everything until the first /* sb patch */) showing and hiding the link editing buttons, as I consider them disturbing only.
Please consider code as a first draft implementation - no big performance tests done - though I did not notice anything negative. As mentioned before: the ID generation is "alpha", the Javascript methods can be improved, too, for sure.
I am really looking forward for your feedback!
Best,
Sven
Comment #10
sven.buschbeck commentedJust realized, the Javascript method jqm_state is called twice.
Updated Javascript Code (last part of it only):
Cheers,
Sven