gpt4 book ai didi

jquery - 有没有办法让我的类覆盖 jQuery 主题的类?

转载 作者:行者123 更新时间:2023-12-01 02:58:53 24 4
gpt4 key购买 nike

我对 jQuery 很陌生,并且对主题覆盖 CSS 类有疑问。

这是我的 HTML 代码:

<head>
.clicked
{
text-decoration: line-through !important;
color: #000000;
}
</head>
...
<div data-role="collapsible" data-theme="b" data-content-theme="b" data-collapsed icon="arrow-r" data-expanded-icon="arrow-d">
<ul data-role="listview" id="Key"></ul>
</div>

这是我的 JS:

function WriteQuote(item) {
$("#"+item).addClass(function(index, currentClass) {
if (currentClass.lastIndexOf("clicked") >= 0) {
$("#"+item).removeClass("clicked");
return;
}
return "clicked";
});
}

我计划使用toggleClass,因此此代码仅用于测试目的。在研究 Firebug 时,我发现 a.ui-link-inherit 是首选并适用:

a.ui-link-inherit {
text-decoration: none !important;
}
.clicked {
color: #000000;
text-decoration: line-through !important;
}

有没有办法让我的类覆盖 jQuery 主题的类?我的目标是当用户单击给定的 ListView 元素时切换“直通”。

最佳答案

主题的 CSS 规则适用,因为它比您的更具体。解决方案是为您的规则添加更多特异性。

a.ui-link-inherit.clicked {
color: #000000;
text-decoration: line-through !important;
}

演示:http://jsfiddle.net/wryE5/

关于jquery - 有没有办法让我的类覆盖 jQuery 主题的类?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14075730/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com