jQuery Mobile - Listview Count bubbles



Description

ui-li-count class define in element will help to include a count indicator in the list item on the right side. Add data-count-theme attribute to set the theme for count bubbles in the list.

Example

Following example demonstrates the use of count bubble list in the jQuery Mobile.

<!DOCTYPE html>
<html>
   <head>
      <meta name = "viewport" content = "width = device-width, initial-scale = 1">
      <link rel = "stylesheet" href = "https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css">
      <script src = "https://code.jquery.com/jquery-1.11.3.min.js"></script>
      <script src = "https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
   </head>

   <body>
      <h2>Count Bubble List Example</h2>
      <ul data-role = "listview" data-count-theme = "b" data-inset = "true">
         <li><a href = "#">Inbox<span class = "ui-li-count">100</span></a></li>
         <li><a href = "#">Starred<span class = "ui-li-count">5</span></a></li>
         <li><a href = "#">Important<span class = "ui-li-count">2</span></a></li>
         <li><a href = "#">Chats<span class = "ui-li-count">6</span></a></li>
         <li><a href = "#">Sent Mail<span class = "ui-li-count">20</span></a></li>
         <li><a href = "#">Drafts<span class = "ui-li-count">12</span></a></li>
      </ul>
   </body>
</html>

Output

Let's carry out the following steps to see how the above code works −

  • Save the above html code as listview_count_bubbles.html file in your server root folder.

  • Open this HTML file as http://localhost/listview_count_bubbles.html and the following output will be displayed.

jquery_mobile_widgets.htm
Advertisements