[themes] Making blocks collapsible

Dale McGladdery torelad at gmail.com
Fri Nov 16 23:23:45 UTC 2007


On 11/16/07, Tim Vaughan < tim at timvaughan.co.uk> wrote:
> What's the easiest way to take an arbitrary D5 or D6 theme and make
> blocks collapsible with javascript?  I'm thinking in particular of the
> Deco theme, and with various menus shown as blocks.  I'd like to be
> able to make blocks collapsible and set as collapsed/uncollapsed by
> default, with visual feedback to show status.

JQuery is part of Drupal core and provides a library for doing this:
http://jquery.com/.

You'll need to write a bit of JavaScript specific to your application.

The best getting started text I've seen to date is in the Pro Drupal
Developers book, though it's still bare essentials. Doing a quick
Google (because you made me curious :-) the best I found in 30 seconds
was this:
- http://del.icio.us/kentbye/jquery
- http://www.slideshare.net/robknight/beginning-jquery-in-drupal-theming/

In a nutshell, the JQuery library is already there. You need to
include your JavaScript code for collapse/uncollapse on the target
page. There are a variety of methods for doing this, the best one
depends on the specific situation (eg: site wide, per page).


More information about the themes mailing list