用户:SegFault:修订间差异
跳转到导航
跳转到搜索
无编辑摘要 |
无编辑摘要 |
||
| 第1行: | 第1行: | ||
{{ | {{widget:FixTableHeader}} | ||
{| class="wikitable fixed-header-table" style="text-align:center;" | |||
|- | |||
! T11 !! T12 !! T13 | |||
|- | |||
! T22 !! T21 !! T23 | |||
|- | |||
| content || content || content | |||
|- | |||
| content || content || content | |||
|- | |||
| content || content || content | |||
|- | |||
| content || content || content | |||
|- | |||
| content || content || content | |||
|- | |||
| content || content || content | |||
|} | |||
blahblah | |||
blah | |||
blahblahblah | |||
{| class="wikitable fixed-header-table" style="text-align:center;" | |||
|- | |||
! T11 !! T12 | |||
|- | |||
! T22 !! T21 | |||
|- | |||
| content || content | |||
|- | |||
| content || content | |||
|- | |||
| content || content | |||
|- | |||
| content || content | |||
|- | |||
| content || content | |||
|- | |||
| content || content | |||
|} | |||
2016年9月27日 (二) 16:13的版本
<style>
- fixed-table-header {
position: fixed; top: 0; margin: 0; border-collapse: separate; border-spacing: 0; border-width: 0; background-color: transparent; pointer-events: none; visibility: hidden;
}
- fixed-table-header > tbody > tr > th {
border-left-width: 0; border-right-width: 0;
}
- fixed-table-header > tbody > tr > td {
border-left-width: 0; border-right-width: 0;
} </style><script> window.onscroll = function() {
var tables = document.getElementsByClassName("fix-table-header");
var clone = document.getElementById('fixed-table-header');
for (var i = 0; i < tables.length; ++i) {
var table = tables[i];
var rect = table.getBoundingClientRect();
if (rect.top < 0 && rect.bottom > 0) {
if (clone == null) {
clone = table.cloneNode(true);
clone.id = 'fixed-table-header';
clone.style.width = table.style.width;
table.parentNode.appendChild(clone);
var rows = clone.getElementsByTagName('TR');
for (var i = 0; i < rows.length; i++) {
if (rows[i].getElementsByTagName('TD').length == 0) {
rows[i].style.visibility = 'visible';
rows[i].style.pointerEvents = 'auto';
} else break;
}
}
return; // don't remove clone
}
}
if (clone != null) clone.remove();
} </script>
| T11 | T12 | T13 |
|---|---|---|
| T22 | T21 | T23 |
| content | content | content |
| content | content | content |
| content | content | content |
| content | content | content |
| content | content | content |
| content | content | content |
blahblah
blah
blahblahblah
| T11 | T12 |
|---|---|
| T22 | T21 |
| content | content |
| content | content |
| content | content |
| content | content |
| content | content |
| content | content |