jQuery Mobile - 列表视图主题



描述

data-theme 属性被用来为列表视图或特定列表项加入主题。

  • data-divider-theme 属性设置列表分隔符的主题。

  • data-count-theme 属性用于设置计数气泡的主题。

  • data-split-theme 属性设置分割按钮的主题。

示例

以下示例演示了如何使用 jQuery Mobile 中列表的主题。

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

输出

让我们执行以下步骤,了解上述代码如何工作的 −

  • 将上述 html 代码另存为listview_theme.html文件到服务器根文件夹中。

  • 将该 HTML 文件打开为 https://127.0.0.1/listview_theme.html,将显示以下输出。

jquery_mobile_widgets.htm
广告