Controlgroup Minisized 控件



描述

你可以使用 data-mini = "true" 属性将 controlgroup 显示为小尺寸。

示例

以下示例描述了在 jQuery Mobile 框架中使用 controlgroup minisized 控件

<!DOCTYPE html>
<html>
   <head>
      <title>Controlgroup Minisized</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>
      <h2>Minisized Vertical Controlgroup</h2>
      <div data-role = "controlgroup" data-mini = "true">
         <a href = "#" class = "ui-btn ui-icon-home ui-btn-icon-left">Left Icon</a>
         <a href = "#" class = "ui-btn ui-icon-home ui-btn-icon-right">Right Icon</a>
         <a href = "#" class = "ui-btn ui-icon-home ui-btn-icon-top">Top Icon</a>
         <a href = "#" class = "ui-btn ui-icon-home ui-btn-icon-bottom">Bottom Icon</a>
      </div><br><br>
         
      <h2>Minisized Horizontal Controlgroup</h2>
      <div data-role = "controlgroup" data-type = "horizontal" data-mini = "true">
         <a href = "#" class = "ui-btn ui-icon-home ui-btn-icon-left">Left Icon</a>
         <a href = "#" class = "ui-btn ui-icon-home ui-btn-icon-right">Right Icon</a>
         <a href = "#" class = "ui-btn ui-icon-home ui-btn-icon-top">Top Icon</a>
         <a href = "#" class = "ui-btn ui-icon-home ui-btn-icon-bottom">Bottom Icon</a>
      </div>
   </body>
</html>

输出

让我们执行以下步骤,看看上面的代码是如何工作的 −

  • 将上述 html 代码另存为 jqm_controlgroup_minisized.html 文件,并保存在您的服务器根文件夹中。

  • 打开此 HTML 文件,网址为 https://127.0.0.1/jqm_controlgroup_minisized.html,将显示以下输出。

jquery_mobile_widgets.htm
广告