【发布时间】:2012-02-13 12:46:41
【问题描述】:
jQuery 1.7.1,tablesorter,IE 8 - 我的表格已经启用,可以使用 tablesorter 插件进行排序。 Tablesorter 插件为标题行中的每个单元格附加背景图像(向上和向下箭头)。我试图将渐变图像附加到标题行,它适用于 Chrome 和 Firefox,但不适用于 IE8。有什么方法可以在 IE 中同时显示渐变和另一个图像(向上和向下箭头)?
HTML
<thead>
<tr class="header">
<th align="center">No</th>
<th align="center">NAME</th>
</tr>
</thead>
CSS(渐变由我提供)
<style type="text/css">
.header {
background: url('images/bl.gif') repeat-x;
}
</style>
CSS(作为 tablesorter 插件的一部分)
table.tablesorter thead tr .header {
background-image: url(images/bg.gif); /* up and down arrow */
background-repeat: no-repeat;
background-position: center right;
cursor: pointer;
}
更新: 根据@fudgey 的建议修改了我的代码,
CSS(作为 tablesorter 插件的一部分)
table.tablesorter thead tr .header span{
background-image: url(images/bg.gif); /* up and down arrow */
background-repeat: no-repeat;
background-position: center right;
cursor: pointer;
}
table.tablesorter thead tr .headerSortUp span{
background-image: url(images/asc.gif);
background-repeat: no-repeat;
}
table.tablesorter thead tr .headerSortDown span{
background-image: url(images/desc.gif);
background-repeat: no-repeat;
}
此外,我稍微修改了 fudgey 代码,
$('#myTable1').tablesorter(
{
onRenderHeader: function (){
this.wrapInner('<span class="grdimg"></span>');
}
});
并添加了一些基于this的CSS,
<style type="text/css">
.grdimg{
float:left; width:100%; min-width:100%;
}
</style>
【问题讨论】:
标签: jquery tablesorter