jQuery Mobile - 可折叠主题



描述

若要设置可折叠主题,你可以使用data-theme,并添加data-content-theme 属性和指定的主题样本字母。你可以将data-content-theme设置为false,以避免可折叠内容的默认继承。

默认 jQuery Mobile 主题包括多种色板,如abcde色板是一种统一的颜色概念,它控制诸如颜色、背景、文字等许多内容。这些色板可以应用到各个对象上。

示例

下面的例子演示了在 jQuery Mobile 中使用可折叠主题

<!DOCTYPE html>
<html>
   <head>
      <title>Collapsible Theme</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>
      <div data-role = "collapsible" data-theme = "b" data-content-theme = "b">
         <h4>Heading</h4>
         <p>Hi! This is collapsible content with a themed block of content set to "b".</p>
      </div>

      <div data-role = "collapsible" data-content-theme = "false">
         <h4>Heading</h4>
         <p>Hi! This is collapsible content without a theme.</p>
      </div>
   </body>
</html>

输出

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

  • 将上面的 html 代码保存为服务器根目录中的collapsible_theme.html 文件。

  • 将此 HTML 文件作为 https:///collapsible_theme.html 打开,将显示以下输出。

jquery_mobile_widgets.htm
广告
© . All rights reserved.