jQuery Mobile: Collapsible Expanded

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

In jQM collapsibles, you can have the content expanded as a default.

This is done by using the attribute data-collapsed=’false’.

<!DOCTYPE html>
<html>
<head>
    <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>
    <title>Codecrawl</title>
</head>
<body>
<div data-role='page'>
    <div data-role='header'><h1>Collapsible</h1></div>
    <br>

    <p>Collapsible Expanded</p>

    <div data-role='collapsible' data-collapsed='false'>
        <h4>Heading</h4>
        <ul data-role='listview'>
            <li><a href='#'>List item 1</a></li>
            <li><a href='#'>List item 2</a></li>
            <li><a href='#'>List item 3</a></li>
        </ul>
    </div>

    <div data-role='footer' data-position='fixed'>
        <h1>Footer</h1>
    </div>
</div>
</body>
</html>
Try The Code

The list has a href which is supposed to be a link and so it will automatically create a > arrow on the right hand side of the list.

Series Navigation<< jQuery Mobile: Collapsible with 2 themes
jQuery Mobile: Icons For Collapsible Set >>

Leave a comment

Leave a Reply