jQuery Mobile - 图标设置

描述

您可以使用 ui-icon 类和 ui-btn-icon-pos_name 类在按钮中设置图标用于指定图标的位置。


示例

以下示例描述了 jQuery Mobile 框架中图标设置 的使用。

<!DOCTYPE html>
<html>
   <head>
      <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 = "main" class = "ui-content">
         <a href = "#" class = "ui-btn ui-btn-icon-left ui-icon-grid">Grid Button</a>
         <button class = "ui-btn ui-btn-icon-left ui-icon-arrow-d-r">arrow-d-r</button>
         <button class = "ui-btn ui-btn-icon-left ui-icon-arrow-l">arrow-l</button>
         <button class = "ui-btn ui-btn-icon-left ui-icon-arrow-r">arrow-r</button>
         <button class = "ui-btn ui-btn-icon-left ui-icon-arrow-u">arrow-u</button>
         <button class = "ui-btn ui-btn-icon-left ui-icon-arrow-u-l">arrow-u-l</button>
         <button class = "ui-btn ui-btn-icon-left ui-icon-arrow-u-r">arrow-u-r</button>
         <button class = "ui-btn ui-btn-icon-left ui-icon-audio">audio</button>
         <button class = "ui-btn ui-btn-icon-left ui-icon-calendar">calendar</button>
         <button class = "ui-btn ui-btn-icon-left ui-icon-camera">camera</button>
         <button class = "ui-btn ui-btn-icon-left ui-icon-carat-l">carat-l</button>
         <button class = "ui-btn ui-btn-icon-left ui-icon-carat-r">carat-r</button>
         <button class = "ui-btn ui-shadow ui-corner-all ui-btn-icon-left 
            ui-icon-check">check</button>
         <button class = "ui-btn ui-shadow ui-corner-all ui-btn-icon-left 
            ui-icon-clock">clock</button>
         <button class = "ui-btn ui-shadow ui-corner-all ui-btn-icon-left ui-icon-eye">
            eye</button>
      </div>
   </body>
</html>

输出

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

  • 将上述 html 代码保存为服务器根文件夹中的 icons_icon_set.html 文件。

  • 将此 HTML 文件打开为 http://localhost/icons_icon_set.html,将显示以下输出。

❮ jQuery Mobile - 图标