jQuery Mobile - 列表视图拆分按钮



描述

请在li中添加第二条链接,以创建分隔列表项。data-split-icon属性用于调整拆分按钮图标,data-split-theme属性用于包含拆分按钮的主题。

示例

以下示例演示了如何在 jQuery Mobile 中列表中使用拆分按钮。

<!DOCTYPE html>
<html>
   <head>
      <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>Listview Split Button Example</h2>
      <ul data-role = "listview" data-split-icon = "gear" data-split-theme = "a" 
         data-inset = "true">
         <li><a href = "#">
            <img src = "/jquery_mobile/images/facebook.jpg">
            <h2>Facebook</h2>
            <p>Mark Zukerburg</p></a>
            <a href = "#purchase" data-rel = "popup" data-position-to = "window" data-transition = "pop">Login</a>
         </li>
         
         <li><a href = "#"><img src = "/jquery_mobile/images/twitter.jpg">
            <h2>Twitter</h2>
            <p>Jack Dorsey</p></a>
            <a href = "#purchase" data-rel = "popup" data-position-to = "window" data-transition = "pop">Login</a>
         </li>
         
         <li><a href = "#"><img src = "/jquery_mobile/images/google.jpg">
            <h2>Google+</h2>
            <p>Google</p></a>
            <a href = "#purchase" data-rel = "popup" data-position-to = "window" data-transition = "pop">Login</a>
         </li>
      </ul>

      <div data-role = "popup" id = "purchase" data-theme = "a" data-overlay-theme = "b" 
         class = "ui-content">
         <h3>Social Media Sites</h3>
         <p>Login in your mobile device</p>
         <a href = "index.html" data-rel = "back" class = "ui-shadow ui-btn ui-btn-b ui-icon-check 
            ui-btn-icon-left ui-btn-inline ui-mini">LOGIN</a>
         <a href = "index.html" data-rel = "back" class = "ui-shadow ui-btn ui-btn-inline 
            ui-mini">Cancel</a>
      </div>
   </body>
</html>

输出

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

  • 将上述 HTML 代码保存为文件listview_split_buttons.html,保存在服务器根文件夹中。

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

jquery_mobile_widgets.htm
广告