作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我对 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;
}
关于jquery - 有没有办法让我的类覆盖 jQuery 主题的类?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14075730/
我是一名优秀的程序员,十分优秀!