Might as well throw my 2 cents in.  Here is my accordion code for a  
ul with an id of navItems with a nested ul:

   $('#navItems > li > ul').hide();
   $('#navItems > li > a').click(function(){
     var ul = $(this).parent().children('ul');
     if ( ul.is(':hidden') ){
       $(this).parent().siblings().children('ul').filter 
(':visible').slideUp();
       ul.slideDown();
     } return false;
   });
   $('#navItems > li').filter('.selected').children('a').trigger 
("click");

On Oct 26, 2006, at 9:35 AM, Klaus Hartl wrote:

> Jörn Zaefferer schrieb:
>>>> By the way, is there interest to put the accordion into the jQuery
>>>> repository?
>>> If you create a subdirectory in SVN/plugins this would be really  
>>> good.
>>> Since Klaus and I also made an accordion plugin, we might need to  
>>> change
>>> that to /plugins/accordion1/ and /plugins/accordion2/.
>>
>> I'd rather try to create a merge or best breed. I think the event  
>> delegation approach is the better one as it uses only a single  
>> event handler, but there are other details you might have solved  
>> better. If I add my soltion to /plugins/accordion/, you are still  
>> free to modify it as you like :-)
>
> I agree. Let's put efforts into one plugin...! I'd say our plugin is
> pretty basic anyway, I'm more dedicated to my tabs and history plugin
> right now.
>
> Franck asked too make it a bit more flexible regarding the HTML
> structure. If you find that reasonable (I do, because it could also  
> be a
> h2+p structure), I have done something similiar for the tabs lately,
> i.e. you set an option too define the HTML structure to rely on.
>
> Could be something like this:
>
> $(...).accordion({
>      struct: 'h2+p'
> });
>
> or
>
> $(...).accordion({
>      struct: 'dl>dd+dt'
> });
>
> One or the other could the default.
>
> Hm, I'm beginning to think that "struct" is a better option name then
> "tabSelector"...
>
>
> -- Klaus
>
> _______________________________________________
> jQuery mailing list
> [email protected]
> http://jquery.com/discuss/


_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to