jQuery 移動 - 列表檢視計數氣泡



描述

元素中定義的ui-li-count 類將有助於在列表項右側包含一個計數指示符。新增data-count-theme屬性可為列表中的計數氣泡設定主題。

示例

以下示例演示了在 jQuery 移動中使用計數氣泡列表的方法。

<!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>

輸出

讓我們執行以下步驟來了解上述程式碼如何工作 −

  • 將上述 html 程式碼另存為伺服器根資料夾中的listview_count_bubbles.html檔案。

  • 將此 HTML 檔案開啟為 https:///listview_count_bubbles.html,將顯示以下輸出。

jquery_mobile_widgets.htm
廣告
© . All rights reserved.