List Badges

Description

A list badge or count bubble is a highlighted oval that typically indicates the number of new items that are available for viewing.

To create a badge, wrap the text of the badge with an element that contains a class of ui-li-count.

By default, badges will be styled with the "c" swatch (gray) color.

To apply an alternate theme, add the data-count-theme attribute to the list element.

Example


<!DOCTYPE html>
<html>
<head>
<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>
/* wrap the text for the movie review */
.ui-li-desc {<!--   ww  w. j a v  a 2s  .  c  om-->
  white-space: normal;
  margin-right: 20px;
}
</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>Movie Review</h1>
    </div>
    <div data-role="content">
      <ul data-role="listview" data-inset="true" data-theme="e">
        <li data-role="list-divider">X-Men
          <p class="ui-li-aside">
            Ratings: <em>1,588</em>
          </p>
        </li>
        <li><img src="http://placehold.it/50x50" class="ui-li-icon">
          <p>This is a test.</p></li>
      </ul>

      <ul data-role="listview" data-inset="true" data-theme="e"
        data-count-theme="e">
        <li data-role="list-divider">Comments
          </p>
        </li>
        <li><img src="http://placehold.it/50x50" class="ui-li-icon">
          <p>Thanks for the review. I plan to check it out this weekend.</p>
          <span class="ui-li-count">1 day</span></li>
        <li><img src="http://placehold.it/50x50" class="ui-li-icon">
          <p>This is a test!</p> 
            <span class="ui-li-count">3 days</span></li>
      </ul>
    </div>
  </div>

</body>
</html>

Click to view the demo





















Home »
  jQuery Mobile »
    Tutorial »




jQuery_Mobile
Form
List
Layout
Theme