jQuery Mobile - Listview Theme



Description

data-theme attribute is added to include the theme for the listview or to the particular list item.

  • data-divider-theme attribute sets the theme for the list divider.

  • data-count-theme attribute is used to set the theme for the count bubbles.

  • data-split-theme attribute sets the theme for the split button.

Example

Following example demonstrates the use of theme in the 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>Listview Theme Example</h2>
      <h3>Count bubble theme</h3>
      <ul data-role = "listview" data-inset = "true" data-theme = "b" 
         data-divider-theme = "a" data-count-theme = "a">
         <li data-role = "list-divider">Mail Box</li>
         <li><a href = "#">Inbox <span class = "ui-li-count">100</span></a></a></li>
         <li><a href = "#">Chats<span class = "ui-li-count">6</span></a></a></li>
         <li><a href = "#">Sent Mail<span class = "ui-li-count">20</span></a></a></li>
      </ul><br/>

      <h3>Split Button theme</h3>
      <ul data-role = "listview" data-split-icon = "plus" data-theme = "a" 
         data-split-theme = "b" data-inset = "true">
         <li><a href = "">Facebook</a>
            <a href = "#purchase" data-rel = "popup" data-position-to = "window" 
               data-transition = "pop">Login</a>
         </li>
            
         <li><a href = "">Twitter</a>
            <a href = "#purchase" data-theme = "a" data-rel = "popup" 
               data-position-to = "window" data-transition = "pop">Login</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_theme.html file in your server root folder.

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

jquery_mobile_widgets.htm
Advertisements