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

輸出

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

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

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

jquery_mobile_widgets.htm
廣告
© . All rights reserved.