jQuery Mobile - 列表檢視縮圖



說明

在列表項中,縮圖包含在左側。將影像作為列表項內的第一個子元素插入。

示例

以下示例演示瞭如何在 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 Thumbnail Example</h2>
      <ul data-role = "listview" data-inset = "true">
         <li><a href = "#">
            <img src = "/jquery_mobile/images/facebook.jpg">
            <h2>Facebook</h2>
            <p>Mark Zukerburg</p></a>
         </li>
         
         <li><a href = "#">
            <img src = "/jquery_mobile/images/twitter.jpg">
            <h2>Twitter</h2>
            <p>Jack Dorsey</p></a>
         </li>
         
         <li><a href = "#">
            <img src = "/jquery_mobile/images/google.jpg">
            <h2>Google+</h2>
            <p>Google</p></a>
         </li>
      </ul>
   </body>
</html>

輸出

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

  • 將上述 HTML 程式碼作為 listview_thumbnail.html 檔案儲存在伺服器根目錄中。

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

jquery_mobile_widgets.htm
廣告
© . All rights reserved.