On Dec 17, 2008, at 11:40 PM, ph...@ryangibbons.net wrote:

>
> Currently I am using "onclick="Effect.toggle..." to toggle various
> divs on http://blog.cpoy.org/dev.php?cat=10 The issue I am running
> into (and please excuse the simplicity of my question) is that this
> will toggle an unlimited number of divs.  What I would prefer that
> that a toggle on closes all previously viewable divs so that only one
> of these options is viewable at once.  Any ideas?
>

Try applying a classname to these elements that you want to toggle.  
Then do something like this in the head of the page:

var elms = $$('div.myClass');
var tog = function(){
        elms.invoke('hide');
        this.show();
};
elms.invoke('hide');
elms.invoke('observe','click',tog);

I believe that will work, and will always keep only the one element  
you just clicked on showing.

Walter

--~--~---------~--~----~------------~-------~--~----~
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 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to