Improvement to Filament Group’s Collapsible Script

26 Nov

After using the Filament Group’s excellent collapsible script at work, I decided to make a couple of minor improvements to it. You can read more about it on their site, but in short it does a great job of providing an easy and accessible way to collapse sections of content.

I simply added a couple of tweaks. First, the ability to expand and collapse the content by using the right and left arrow keys, respectively, when focused on the trigger element. Previously you could only do this by using the enter key (which is equivalent to a click). Second, the ability to start the element collapsed instead of expanded. You can do this by passing the value “true” to the function when initiating the collapsible section:

$('h2').collapsible(true);

You can find my changed version for download here.

Advertisement

Tags: , , ,

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 )

Connecting to %s

Follow

Get every new post delivered to your Inbox.