The collapsible plugin has the following options:
collapsed
booleandefault: 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
stringdefault: " 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
stringdefault: "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
stringdefault: 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
booleandefault: 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
stringdefault: " 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
stringdefault: "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
stringdefault: "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
stringdefault: "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 stringdefault: ":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
booleandefault: 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
booleandefault: 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
stringdefault: 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"
.