jQuery Mobile - 列表檢視格式化內容



說明

使用標題和段落標記以正確的層次格式新增內容。新增 ui-li-aside 類可在列表項右側新增補充資訊。

示例

以下示例演示了在 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 Formatted Content Example</h2>
      <ul data-role = "listview" data-inset = "true">
         <li data-role = "list-divider">Wednesday, January 13, 2016 
            <span class = "ui-li-count">2</span></li>
            
         <li><a href = "#">
            <h2>John</h2>
            <p><strong>Team Meeting</strong></p>
            <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.</p></a>
            <p class = "ui-li-aside"><strong>12:48</strong>PM</p>
         </li>
         
         <li><a href = "#">
            <h2>Albert</h2>
            <p><strong>Updation of work</strong></p>
            <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.</p></a>
            <p class = "ui-li-aside"><strong>4:01</strong>PM</p>
         </li>
         
         <li data-role = "list-divider">Thursday, January 14, 2016 
            <span class = "ui-li-count">2</span></li>
            
         <li><a href = "#"><h2>Joy</h2>
            <p><strong>New Project Information</strong></p>
            <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.</p></a>
            <p class = "ui-li-aside"><strong>09:25</strong>PM</p>
         </li>
      </ul>
   </body>
</html>

輸出

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

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

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

jquery_mobile_widgets.htm
廣告
© . All rights reserved.