You could improve performance a little bit by skipping the each and
using invoke. You'd have to modify some of the stuff, such as your
declaration of section_id but it wouldn't be too difficult to convert.

$$("a.more").invoke("observe", "click", function);

http://prototypejs.org/api/enumerable/invoke



On Sep 24, 10:49 am, solidhex <[EMAIL PROTECTED]> wrote:
> Here is the actual js in case you don't want to follow the link:
>
> document.observe("dom:loaded", function() {
>         var divs = $$("div.content");
>         divs.invoke('hide').first().show();
>         var subs = $$("ul#nav ul");
>         subs.invoke("hide")
>         $$("a.more").each(function(link) {
>                 var section_id = link.readAttribute("href").sub("#",'');
>                 link.observe("click", function(event) {
>                         subs.invoke("hide");
>                         var element = Event.element(event);
>                         $(element).next('ul').show();
>                         divs.invoke("hide");
>                         $(section_id).show();
>                         event.preventDefault();
>                 });
>         });
>
> });
>
> On Sep 23, 12:20 pm, solidhex <[EMAIL PROTECTED]> wrote:
>
> > Hi All
>
> > I need to setup a show/hide navigation with nested <ul> elements. I've
> > gotten it to work, but it seems like my code is kind of clunky and
> > sloppy. Anyone have any ideas on how to make it better? Looking
> > forward to hearing input.
>
> > Oh, and this is my first discussion here :)
>
> >http://solidhex.com/code-samples/prototype/list.html
>
> > thanks!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to