控制组微型小部件
描述
您可以使用 data-mini = "true" 属性以小尺寸显示控制组。
示例
以下示例描述了在 jQuery Mobile 框架中使用 控制组微型小部件。
<!DOCTYPE html> <html> <head> <title>Controlgroup Minisized</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> <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 文件打开为 http://localhost/jqm_controlgroup_minisized.html,将显示以下输出。