jQuery Mobile - 巢狀可摺疊



說明

可摺疊可以在其他可摺疊內容內巢狀。

示例

以下示例演示了在 jQuery Mobile 中巢狀可摺疊的使用。

<!DOCTYPE html>
<html>
   <head>
      <title>Collapsible nested</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">
         <h1>Click me</h1>
         <p>This is collapsible content.</p>
         <div data-role = "collapsible">
            <h1>Click me</h1>
            <p>This is nested collapsible content.</p>
         </div>
      </div>
   </body>
</html>

輸出

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

  • 將上述 html 程式碼儲存為 collapsible_nested.html 檔案,存放在伺服器根資料夾中。

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

jquery_mobile_widgets.htm
廣告
© . All rights reserved.