Q
粘表標題
3
A
回答
4
這裏有一個工作示例:fiddle
所有我改變了這一行的末尾:
if ((scrollTop > offset.top) && (scrollTop < offset.top + $this.height()-base.$clonedHeader.height())) {
1
1
我知道ŧ他是老了,但我覺得奉獻的東西,可以幫助一些......
對於動態表(其中每個單元的寬度是預先計算),這個插件打亂了標題行的寬度。
我做了幫助計算基於從基於第一TBODY行的單元,每個單元outerWidth寬度的一些變化。
出在插件當前寬度計算首評:
base.updateWidth = function() {
// Copy cell widths and classes from original header
$('th', base.$clonedHeader).each(function (index) {
var $this = $(this);
var $origCell = $('th', base.$originalHeader).eq(index);
this.className = $origCell.attr('class') || '';
//$this.css('width', $origCell.width());
});
// Copy row width from whole table
//base.$clonedHeader.css('width', base.$originalHeader.width());
};
// Run initializer
base.init();
然後添加以下base.toggleHeaders的末尾=函數(){
// Set cell widths for header cells based on first row's cells
var firstTr = $this.children("tbody").children("tr").first();
var iCol = 0;
$(firstTr).children("td:visible").each(function()
{
var colWidth = $(this).outerWidth();
console.log(colWidth.toString());
var headerCell = $this.children("thead.tableFloatingHeader").children("tr").children("th:eq(" + iCol + ")");
var firstRowCell = $this.children("tbody").children("tr:first").children("td:eq(" + iCol + ")");
$(headerCell).outerWidth(colWidth);
$(firstRowCell).outerWidth(colWidth);
iCol++;
});
0
我寫一個jquery庫這使得表中可以固定在頁面的頂部,準確地消失在最後一排走了
這是一個小的jQuery庫函數與ScrollFix 01組合庫提供固定在主菜單下的表頭表。該庫還支持在同一個頁面
相關問題
- 1. 電子反應粘表標題
- 2. 水平滾動粘HTML表格標題
- 3. 粘滯列和標題在引導表
- 4. 列表框中的粘性組標題
- 5. 如何爲多個表格標題製作粘性標題?
- 6. 如何使表格標題粘貼標題?
- 7. jQuery的粘性標題
- 8. 粘腳W /側面標題
- 9. 滾動粘滯標題
- 10. 粘滯標題動畫
- 11. 隱藏粘性標題欄
- 12. 粘性標題CSS/JS
- 13. PHP粘性表單問題
- 14. 創建粘性標題和粘性側邊欄?
- 15. WordPress的 - avada主題,生澀標題和標誌跳出粘滯標題
- 16. 在上面創建粘性標題
- 17. JavaScript庫以粘滯標題移動
- 18. 粘性標題並不總是顯示
- 19. jquery粘貼標題與調整大小
- 20. 浮動標題與粘性頁腳
- 21. UICollectionViewFlowLayout子類粘滯和伸展標題
- 22. HTML5:粘性頁腳,標題和文章
- 23. Jquery標籤插件粘貼問題
- 24. 用粘性TabStrip標題滾動viewpager
- 25. UICollectionView部分標題粘到某個Y
- 26. 二級菜單粘到標題
- 27. AppBar標題粘貼在屏幕左側
- 28. 視頻標籤粘貼問題
- 29. 帶滾動背景的粘性標題
- 30. 可變高度的粘性標題
你應該做一個[拉請求( https://github.com/jmosbech/StickyTableHeaders/pulls) – PiTheNumber
嘿vonflow,我認爲你擊中了現場,你能更好地解釋我哪一行你解決了嗎?我只是簡單地在Jsfiddle中做了一個粘貼和複製代碼,它似乎也適用於我的項目。我會在github上提一下你的名字。由於 – Koala7
其實我只是想出瞭如何做拉請求,所以我剛想把它英寸 – vonflow