List Dividers

Description

A list divider can be used as a heading for a group of list items.

To create a list divider, add the data-role="list-divider" attribute to any list item. The list divider's default text will appear left-aligned.

To position text right-aligned, wrap it with an element that contains a class of ui-li-aside.

By default, list dividers will be styled with the "b" swatch (light blue) color. To apply an alternate theme, add the data-divider-theme="a" attribute to the list element.

Example


<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>List Dividers</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet"
  href="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.css" />
<style>
.segmented-control {<!--from ww w.ja va2 s  .  com-->
  text-align: center;
}

.segmented-control .ui-controlgroup {
  margin: 0.2em;
}

.ui-control-active, .ui-control-inactive {
  border-style: solid;
  border-color: gray;
}

.ui-control-active {
  background: #BBB;
}

.ui-control-inactive {
  background: #DDD;
}
</style>
<script src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
<script src="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.js"></script>
</head>
<body>

  <div data-role="page">
    <div data-role="header">
      <h1>Calendar</h1>
    </div>

    <div data-role="content">
      <ul data-role="listview" data-filter="true" data-divider-theme="b">
        <li data-role="list-divider">Mon
          <p class="ui-li-aside">
            <strong>Feb 6 2014</strong>
          </p>
        </li>
        <li><a href="#">
        <p><strong>6</strong> PM<span class="ui-li-aside">
           <strong>Birthday Party</strong></span>
            </p></a></li>
        <li data-role="list-divider">Wed
          <p class="ui-li-aside">
            <strong>Feb 8 2014</strong>
          </p>
        </li>
        <li><a href="#">
        <p><strong>6</strong> PM<span class="ui-li-aside">
        <strong>User Group Meeting</strong></span>
            </p></a></li>
        <li data-role="list-divider">Fri
          <p class="ui-li-aside">
            <strong>Feb 10 2014</strong>
          </p>
        </li>
        <li><a href="#">
        <p><strong>2</strong> PM<span class="ui-li-aside">
           <strong>Skiing</strong></span>
            </p></a></li>
        <li><a href="#">
        <p><strong>5</strong> PM<span class="ui-li-aside">
        <strong>Birthday</strong></span>
            </p></a></li>
      </ul>
    </div>

    <!-- Toolbar with a segmented control -->
    <div data-role="footer" data-position="fixed" data-theme="d"
      class="segmented-control">
      <div data-role="controlgroup" data-type="horizontal">
        <a href="#" data-role="button" class="ui-control-active">List</a> <a
          href="#" data-role="button" class="ui-control-inactive">Day</a> <a
          href="#" data-role="button" class="ui-control-inactive">Month</a>
      </div>
    </div>
  </div>

</body>
</html>

Click to view the demo





















Home »
  jQuery Mobile »
    Tutorial »




jQuery_Mobile
Form
List
Layout
Theme