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 ).on( "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 ).on( "mobileinit", function(){
    $.mobile.collapsible.prototype.options.collapseCueText = " collapse with a click";
});
collapsedIcon string

default: "plus"

Sets the icon for the header of the collapsible container when in a collapsed state. To set the value for all instances of this widget, bind this option to the mobileinit event:

$( document ).on( "mobileinit", function(){
    $.mobile.collapsible.prototype.options.collapsedIcon = "arrow-r";
});

This option is also exposed as a data attribute: data-collapsed-icon="arrow-r".

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 one of the swatches included in your theme. To set the value for all instances of this widget, bind this option to the mobileinit event:

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

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

corners boolean

default: true

Applies the theme border-radius if set to true. To set the value for all instances of this widget, bind this option to the mobileinit event:

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

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

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 ).on( "mobileinit", function(){
    $.mobile.collapsible.prototype.options.expandCueText = " expand with a click";
});
expandedIcon string

default: "minus"

Sets the icon for the header of the collapsible container when in an expanded state. To set the value for all instances of this widget, bind this option to the mobileinit event:

$( document ).on( "mobileinit", function(){
    $.mobile.collapsible.prototype.options.expandedIcon = "arrow-d";
});

This option is also exposed as a data attribute: data-expanded-icon="arrow-d".

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 ).on( "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 ).on( "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 ).on( "mobileinit", function(){
    $.mobile.collapsible.prototype.options.initSelector = ".mycollapsible";
});
inset boolean

default: true

By setting this option to false the element will get a full width appearance without corners. 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 ).on( "mobileinit", function(){
    $.mobile.collapsible.prototype.options.inset = false;
});

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

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 ).on( "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 one of the swatches included in your theme. To set the value for all instances of this widget, bind this option to the mobileinit event:

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

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