jQuery Mobile - 迷你可摺疊



說明

無論何時需要一個版本緊湊的可摺疊版本,都可以使用小尺寸。這可以透過使用 data-mini 並將其設定為 true 來實現。

示例

以下示例演示在 jQuery Mobile 中使用 小型可摺疊

<!DOCTYPE html>
<html>
   <head>
      <title>Mini sized collapsible</title>
      <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>
      <div data-role = "collapsible" data-mini = "true">
         <h4>Heading</h4>
         <ul data-role = "listview">
            <li><a href = "#">Item 1</a></li>
            <li><a href = "#">Item 2</a></li>
            <li><a href = "#">Item 3</a></li>
         </ul>
      </div>
   </body>
</html>

輸出

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

  • 將以上 html 程式碼儲存在伺服器根資料夾中,名為 collapsible_mini_sized.html 的檔案中。

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

jquery_mobile_widgets.htm
廣告
© . All rights reserved.