Thursday, January 21, 2010

Expand / Collapse Feature for Web Parts

Great web part for collapsing web part contents

You import the webpart to the bottom of the page, (or create a content editor web part and paste the script, hide the chrome)

Then, create a new web part (I've created a new CEWP and used chrome as question and body as answer for FAQ look page), or use one you already have.

Remember, for auto collapsing at page load, go to webpart properties, apearance, chrome state, "Minimized"

You can download & import the dwp
CollapseWPs dwp WebPart

or create it yourself and add the script to the CEWP's source
CollapseWPs script


  1. Worked immediately!
    Is there a way to get this to only collapse-expand certain web parts in the page rather than applying the option to all of them?

  2. yes.
    you would have to edit the javascript file to bypass specific web part ids

    something like this

    //if different page, or your page's webpartid
    if((window.location != "your_url") || (WPid != "webpartWebPartWPQ5"))
    //code in try / catch