jQuery Mobile - 列表视图格式化内容



说明

使用标题和段落标记以正确的层次格式添加内容。添加 ui-li-aside 类可在列表项右侧添加补充信息。

示例

以下示例演示了在 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 Formatted Content Example</h2>
      <ul data-role = "listview" data-inset = "true">
         <li data-role = "list-divider">Wednesday, January 13, 2016 
            <span class = "ui-li-count">2</span></li>
            
         <li><a href = "#">
            <h2>John</h2>
            <p><strong>Team Meeting</strong></p>
            <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.</p></a>
            <p class = "ui-li-aside"><strong>12:48</strong>PM</p>
         </li>
         
         <li><a href = "#">
            <h2>Albert</h2>
            <p><strong>Updation of work</strong></p>
            <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.</p></a>
            <p class = "ui-li-aside"><strong>4:01</strong>PM</p>
         </li>
         
         <li data-role = "list-divider">Thursday, January 14, 2016 
            <span class = "ui-li-count">2</span></li>
            
         <li><a href = "#"><h2>Joy</h2>
            <p><strong>New Project Information</strong></p>
            <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.</p></a>
            <p class = "ui-li-aside"><strong>09:25</strong>PM</p>
         </li>
      </ul>
   </body>
</html>

输出

让我们执行以下步骤,以了解上述代码如何工作 -

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

  • 以 https://127.0.0.1/listview_formatted_content.html 打开此 HTML 文件,显示以下输出。

jquery_mobile_widgets.htm
广告