问题描述
我希望能够调整"HTML 表格的演示文稿以添加单个功能:向下滚动页面以使表格在屏幕上但标题行不在屏幕上时,我希望标题在查看区域的顶部保持可见.
I would like to be able to "tweak" an HTML table's presentation to add a single feature: when scrolling down through the page so that the table is on the screen but the header rows are off-screen, I would like the headers to remain visible at the top of the viewing area.
这在概念上类似于 Excel 中的冻结窗格"功能.但是,一个 HTML 页面中可能包含多个表,我只希望它发生在当前处于视图中的表中,并且仅在它处于视图中时发生.
This would be conceptually like the "freeze panes" feature in Excel. However, an HTML page might contain several tables in it and I only would want it to happen for the table that is currently in-view, only while it is in-view.
注意:我见过一种解决方案,其中表数据区域可滚动而标题不滚动.这不是我正在寻找的解决方案.
Note: I've seen one solution where the table data area is made scrollable while the headers do not scroll. That's not the solution I'm looking for.
推荐答案
查看 jQuery.floatThead(可用演示)非常酷,可以与DataTables一起使用也可以,甚至可以在 overflow: auto
容器内工作.
Check out jQuery.floatThead (demos available) which is very cool, can work with DataTables too, and can even work inside an overflow: auto
container.
这篇关于查看大表格时,HTML 表格标题始终显示在窗口顶部的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!