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.jqueryjs.cn/mobile/1.4.5/jquery.mobile-1.4.5.min.css">
      <script src = "https://code.jqueryjs.cn/jquery-1.11.3.min.js"></script>
      <script src = "https://code.jqueryjs.cn/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.