我在网站上创建了一个可折叠的集,看起来像这样:

<div data-role="collapsible-set" id="result" style="margin: auto; padding-top: 50px; padding-bottom: 20px;">
     <div>
         <h2>
        <span style="font-size: 16px; font-weight: bold; white-space: pre-wrap;" id="title' + num + '">abc</span><br>
        <span style="font-size: 14px; font-weight: normal;" id="author' + num + '"></span>
        <div style="font-weight: normal;">
            <span style="font-style:italic; font-size: 13px;" id="journal' + num + '"></span>
        </div>
        </h2>
        <div style="font-size: 14px;">
            more info
        </div>
     </div>
</div>

但是,在将主题应用于添加到可折叠集中的每个元素之后,我的样式已更改,我不知道为什么。在将可折叠集内添加div之前,需要添加以下属性:
div.setAttribute("data-theme", "c");

这是样式之前我的列表项的样子:

这是添加主题后的样子:

如您所见,每行之间的间距现在很大。我试图使用填充来更改CSS,但这并没有改变任何东西。有人能指出我正确的方向吗?

这是之前和之后的小提琴:

Before

After

最佳答案

您需要使用jQuery Mobile ThemeRoller升级theme-classic.css

  • 转到download page并向下滚动到“旧版”
  • 在1.3.2版下-CSS打开Uncompressed with Default theme: jquery.mobile-1.3.2.css,复制其内容。
  • 转到jQuery Mobile ThemeRoller,从顶部工具栏单击“导入或升级”。新的窗口将会打开
  • 在该窗口上,粘贴1.3.2 CSS样式。从选择菜单中,选择“升级到版本1.4.5”,然后单击“导入”按钮
  • 查看复制的主题,并根据需要进行更改。完成后,从顶部工具栏单击“下载”,为您的主题指定一个自定义名称,然后下载升级的经典主题。
  • 按以下顺序放置新主题和其他依赖项
    <head>
      <link rel="stylesheet" href="css/themes/my-custom-theme.css" />
      <link rel="stylesheet" href="css/themes/jquery.mobile.icons.min.css" />
      <link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.5/jquery.mobile.structure-1.4.5.min.css" />
      <script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
      <script src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
    </head>
    

  • 关于javascript - 改变我的jQuery移动主题改变我的CSS样式,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/26987535/

    10-12 12:26
    查看更多