我正在使用 tablesorter 2.0,我一直在尝试在单击按钮时覆盖 css 主题,但我似乎无法进行任何操作。我试图在主题文件中添加一点 css,但我认为另一个属性覆盖了它。我想要做的是更改某个类的一行的背景颜色。
如果有人能检查出来并告诉我在哪里添加类和属性到这个文件,我们将不胜感激。
这是 tablesorter 的主题文件:
table.tablesorter {
font-family:arial;
background-color: #CDCDCD;
margin:10px 0pt 15px;
font-size: 8pt;
width: 100%;
text-align: left;
border-radius:3px;
}
table.tablesorter thead tr th, table.tablesorter tfoot tr th {
background-color: #e6EEEE;
border: 1px solid #FFF;
font-size: 8pt;
padding: 4px;
}
table.tablesorter thead tr .header {
background-image: url(bg.gif);
background-repeat: no-repeat;
background-position: center right;
cursor: pointer;
}
table.tablesorter tbody td {
color: #3D3D3D;
padding: 4px;
background-color: #FFF;
vertical-align: top;
}
table.tablesorter tbody tr.odd td {
background-color:#F0F0F6;
}
table.tablesorter thead tr .headerSortUp {
background-image: url(asc.gif);
}
table.tablesorter thead tr .headerSortDown {
background-image: url(desc.gif);
}
table.tablesorter thead tr .headerSortDown, table.tablesorter thead tr .headerSortUp {
background-color: #5B5781;
}
这是我用来更改行的 jquery css(它是 $.post() 调用的回调):
function(){
$("#row_"+id).css("background-color", "orange");
}
最佳答案
TR 有背景颜色没有错。
您的代码有效,但您必须意识到您指定 TD 的背景颜色为#FFF。您正在更改 TR 的 BG 颜色,但 TD 的颜色在它上面。
关于jquery - Tablesorter 主题,单击按钮更改行背景,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6022048/