jQuery Mobile - 列表檢視自動分隔符



說明

包括data-autodividers = "true" 屬性以在任何列表檢視中自動生成分隔符。

示例

以下示例演示了在 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>List Autodividers Example</h2>
      <ul data-role = "listview" data-autodividers = "true" data-filter = "true" 
         data-inset = "true">
         <li><a href = "#">Dharwad</a></li>
         <li><a href = "#">Davangere</a></li>
         <li><a href = "#">Mangalore</a></li>
         <li><a href = "#">Mumbai</a></li>
         <li><a href = "#">Pune</a></li>
         <li><a href = "#">Punjab</a></li>
      </ul>
   </body>
</html>

輸出

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

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

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

jquery_mobile_widgets.htm
廣告
© . All rights reserved.