Fetching contributors…
Cannot retrieve contributors at this time
59 lines (45 sloc) 1.76 KB

jQuery Collapse

A lightweight plugin for enabling expandable/collapsible content.

  • Packaged with cookie support (yum yum!)
  • Lightweight (655 bytes minified and gzipped)
  • ARIA compliant




<div id="demo">
        <p>You can use any container you like (in this case a div)</p>


<script src=""></script>
<script src="jquery.collapse.js"></script>
<script src="jquery.cookie.js"></script> <!-- If you want cookie support -->
$(function() {

Note: If you're using the plugin on different pages on the same domain, you'll have to have a unique cookie name for each instance to avoid conflict. Use the "cookie" option to set a unique cookie name.


  • show (function) : Custom function for showing content (default: function(){ })
  • hide (function) : Custom function for hiding content (default: function(){ this.hide() })
  • head (string) : Elements for clickable headings (default: "h3")
  • group (string): Elements containing the collapsable content (default: "ul, div")
  • cookieName (string) : Name of cookie used in the plugin. (default: "collapse")

Browser Support

Probably works in most modern browsers, but only tested in: Safari, Chrome, IE6+, Firefox3+, Opera10+

Google Chrome does not work with cookies if run locally (i.e file://) For more details: