Collapsible

Home Search

Collapsible content

The collapsible plugin has the following options:

collapsed boolean

default: true

When false, the container is initially expanded with a minus icon in the header. To set the value for all instances of this widget, bind this option to the mobileinit event:

$( document ).bind( "mobileinit", function(){
    $.mobile.collapsible.prototype.options.collapsed = false;
});

This option is also exposed as a data attribute: data-collapsed="false".

collapseCueText string

default: " click to collapse contents"

This text is used to provide audible feedback for users with screen reader software. To set the value for all instances of this widget, bind this option to the mobileinit event:

$( document ).bind( "mobileinit", function(){
    $.mobile.collapsible.prototype.options.collapseCueText = " collapse with a click";
});
contentTheme string

default: null, inherited from parent

Sets the color scheme (swatch) for the collapsible content block. It accepts a single letter from a-z that maps to the swatches included in your theme. To set the value for all instances of this widget, bind this option to the mobileinit event:

$( document ).bind( "mobileinit", function(){
    $.mobile.collapsible.prototype.options.contentTheme = "a";
});

This option is also exposed as a data attribute: data-content-theme="a".

expandCueText string

default: " click to expand contents"

This text is used to provide audible feedback for users with screen reader software. To set the value for all instances of this widget, bind this option to the mobileinit event:

$( document ).bind( "mobileinit", function(){
    $.mobile.collapsible.prototype.options.expandCueText = " expand with a click";
});
heading string

default: "h1,h2,h3,h4,h5,h6,legend"

Within the collapsible container, the first immediate child element that matches this selector will be used as the header for the collapsible. To change the selector, bind this option to the mobileinit event:

$( document ).bind( "mobileinit", function(){
    $.mobile.collapsible.prototype.options.heading = ".mycollapsibleheading";
});
iconpos string

default: "left"

Positions the icon in the collapsible header. Possible values: left, right, top, bottom, none, notext.

$( document ).bind( "mobileinit", function(){
    $.mobile.collapsible.prototype.options.iconpos = "right";
});

This option is also exposed as a data attribute: data-iconpos="right".

initSelector CSS selector string

default: ":jqmData(role='collapsible')"

This is used to define the selectors (element types, data roles, etc.) that will automatically be initialized as collapsibles. To change which elements are initialized, bind this option to the mobileinit event:

$( document ).bind( "mobileinit", function(){
    $.mobile.collapsible.prototype.options.initSelector = ".mycollapsible";
});
mini boolean

default: false

Sets the size of the element to a more compact, mini version. If the value is false for an individual collapsible container, but that container is part of a collapsible set, then the value is inherited from the parent collapsible set. To set the value for all instances of this widget, bind this option to the mobileinit event:

$( document ).bind( "mobileinit", function(){
    $.mobile.collapsible.prototype.options.mini = true;
});

This option is also exposed as a data attribute: data-mini="true".

theme string

default: null, inherited from parent

Sets the color scheme (swatch) for the collapsible. It accepts a single letter from a-z that maps to the swatches included in your theme. To set the value for all instances of this widget, bind this option to the mobileinit event:

$( document ).bind( "mobileinit", function(){
    $.mobile.collapsible.prototype.options.theme = "a";
});

This option is also exposed as a data attribute: data-theme="a".