jQuery Mobile: Icons For Collapsible Set

This entry is part 28 of 73 in the series jQuery Mobile

jQuery Mobile provides a set of icons that we can use.

The default icons of collapsible headings can be overridden by using the data-collapsed-icon and data-expanded-icon attributes.

In the example below, we have used data-collapsed-icon=’carat-d’ for the down arrow and data-expanded-icon=’carat-u’ for the up arrow.

<!DOCTYPE html>
    <link href='http://code.jquery.com/mobile/1.4.0/jquery.mobile-1.4.0.min.css' rel='stylesheet'/>
    <script src='http://code.jquery.com/jquery-1.10.2.min.js'></script>
    <script src='http://code.jquery.com/mobile/1.4.0/jquery.mobile-1.4.0.min.js'></script>
<div data-role='page'>
    <div data-role='header'><h1>Collapsible</h1></div>

    <p>Collapsible Icons</p>

    <div data-role='collapsible' data-collapsed-icon='carat-d' data-expanded-icon='carat-u'>
        <ul data-role='listview' data-inset='false'>
            <li>Read-only list item 1</li>
            <li>Read-only list item 2</li>
            <li>Read-only list item 3</li>

    <div data-role='footer' data-position='fixed'>
Try The Code

Notice that in line 18, I have used data-inset=’false’.

By default collapsibles have an inset appearance. To make them full width without corner styling add the data-inset=’false’ attribute to the element.

Series Navigation<< jQuery Mobile: Collapsible Expanded
jQuery Mobile: A Form Inside A Collapsible Content List >>