Multiply Nested Accordions from jQuery tools with empty bits!

Earlier this month I posted my solution for Multiply Nested Accordions, the only issue I had then was how the accordion worked with headers in the accordion with no matching content pane – I am using the accordions as generated by ColdFusion dynamically, so sometimes there is an empty div that looked ‘tacky’.

So without delay, the code:


var accordion = $(".accordion");

accordion = accordion.filter(":has(.pane)");//ignores accordions with no panes

accordion.tabs(".pane", {tabs: '> h2:has(+ .pane)', effect: 'slide', initialIndex: null});//only tabs with a pane after are used as triggers

About Simeon Cheeseman

I enjoy a wide variety of computer and board games, have a BSc in Computer Science and have played percussion for 18 years.

Posted on January 29, 2011, in jQuery, jQuery Tools. Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: