gpt4 book ai didi

jquery - tablesorter 不显示上下箭头

转载 作者:太空狗 更新时间:2023-10-29 15:08:45 25 4
gpt4 key购买 nike

我正在尝试使用 JQuery tablesoter 插件,但是在显示箭头时,当我按降序或升序排序时,它既不显示向下箭头也不显示向上箭头。它总是显示向上和向下箭头(未排序的箭头)。似乎 table.tablesorter .header {...} 覆盖了 table.tablesorter .headerSortUp {...} 和 table.tablesorter .headerSortDown{...} 样式。下面是我的代码:

CSS

table.tablesorter .headerSortUp {
background-image: url('../images/icons/asc.gif');
background-repeat: no-repeat;
background-position: center right;
}
table.tablesorter .headerSortDown {
background-image: url('../images/icons/desc.gif');
background-repeat: no-repeat;
background-position: center right;
}
table.tablesorter .header {
cursor: pointer;
background-image: url('../images/icons/bg.gif');
background-repeat: no-repeat;
background-position: center right;
}

我的表在速度模板中,但我认为这不会影响这个问题。

<table id="harvestTable" class="tablesorter" border="1">
<thead>
<tr>
<th>Source</th>
<th>Time</th>
</tr>
</thead>
<tbody>
#foreach($item in $self.harvestlist)
#set($harvestId = $item.getFirst('harvestId'))
...

并且我在各个文件夹中包含了相关图标。我正在使用 chrome 并在 firefox 上进行了测试,但两者都不起作用。当我检查 chrome 中的元素时,我可以看到 .header 的图像覆盖了 .headerSortUp 和 .headerSortDown 图像。如果我取消选择 .header 的图像,.headerSortUp 图像会正确显示。

我在这里错过了什么吗?非常感谢宝贵的回复。

谢谢

最佳答案

您遇到的问题是由于 css specificity 引起的(试试 this calculator ):

默认的蓝色主题使用:

table.tablesorter thead tr .headerSortUp {} // (0,0,2,3)

因此,为了覆盖它,您需要更高的 css 特异性。一种方法是将 th 添加到排序类​​:

table.tablesorter thead tr th.headerSortUp {} // (0,0,2,4)

关于jquery - tablesorter 不显示上下箭头,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15756847/

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