当 URL 包含哈希时,tablesorter 上的 stickyHeaders 小部件覆盖表格的第一行时遇到问题。
例如 living.php?tab=1#sacramento1
该页面显示正确的选项卡并跳转到正确的行,但标题显示在该行上方。
为了解决这个问题,如果 url 中有哈希,我一直在禁用 stickyHeader 小部件
这就是我正在做的事情:
<script type="text/javascript">$(document).ready(function()
{
//CHECK for hash. don't want sticky headers with hash
if (window.location.hash) {
var workingID = window.location.hash;
tid=workingID.substr(1,workingID.length);
document.getElementById(tid).setAttribute("class", "showRow");
// extend the default setting to always include the zebra widget.
$.tablesorter.defaults.widgets = ['zebra'];
} else {
// extend the default setting to always include the zebra widget and the sticky headers.
$.tablesorter.defaults.widgets = ['zebra','stickyHeaders'];
}
// extend the default setting to always sort on the first column
$.tablesorter.defaults.sortList = [[0,0]];
// call the tablesorter plugin
$("table").tablesorter();
}
);
有没有办法让stickyHeaders 识别哈希行并将其显示在标题下方?