admin管理员组文章数量:1026989
I've got a large table, where the user typically needs to scroll the page to find data. This makes it difficult to track columns/rows once the headers are no longer visible. I'd like to keep the headers visible while scrolling.
I've managed to get the first row (column headers) to stay visible (jsfiddle example), but am at a loss to do the same for the first column.
PS: I don't need an iframe solution (with extra scrolls), but one similar to what I have, but for the first column.
EDIT: I've done it: jsfiddle example
I've got a large table, where the user typically needs to scroll the page to find data. This makes it difficult to track columns/rows once the headers are no longer visible. I'd like to keep the headers visible while scrolling.
I've managed to get the first row (column headers) to stay visible (jsfiddle example), but am at a loss to do the same for the first column.
PS: I don't need an iframe solution (with extra scrolls), but one similar to what I have, but for the first column.
EDIT: I've done it: jsfiddle example
- Possible duplicate of: stackoverflow./questions/1030043/… – Quasdunk Commented Sep 15, 2011 at 15:30
- Not a duplicate. I need BOTH the first row and the first column to stay visible. I could't find an answer to this on stackoverflow. – radonys Commented Sep 15, 2011 at 15:34
- 1 There are a lot of working JS solutions out on the web. For example datatables – what you are searching for is a bination of the "FixedColumns" and the "FixedHeader" plug-ins (if using jQuery-datatables). BTW: your solution flickers heavy while scrolling. – feeela Commented Sep 15, 2011 at 15:44
- Note that if you keep scrolling in your example the result flips from bottom of table back to top – mrtsherman Commented Sep 15, 2011 at 19:10
- @mrtsherman You're right, the code is not perfect... – radonys Commented Sep 15, 2011 at 20:52
2 Answers
Reset to default 3Using JS seems to be a bit overkill for this solution. Working with tables can be a pain in the neck, but there's a CSS property called position: fixed
which could be used for this purpose. I've put together a demo which isn't 100% perfect when it es to lining things up, but it demonstrates how to use it for your application.
DEMO: http://wecodesign./demos/stackoverflow-7433377.htm
For those interested, I fixed the flickering and the flipping, and the result is now perfect (for me). (jsfiddle example)
I've got a large table, where the user typically needs to scroll the page to find data. This makes it difficult to track columns/rows once the headers are no longer visible. I'd like to keep the headers visible while scrolling.
I've managed to get the first row (column headers) to stay visible (jsfiddle example), but am at a loss to do the same for the first column.
PS: I don't need an iframe solution (with extra scrolls), but one similar to what I have, but for the first column.
EDIT: I've done it: jsfiddle example
I've got a large table, where the user typically needs to scroll the page to find data. This makes it difficult to track columns/rows once the headers are no longer visible. I'd like to keep the headers visible while scrolling.
I've managed to get the first row (column headers) to stay visible (jsfiddle example), but am at a loss to do the same for the first column.
PS: I don't need an iframe solution (with extra scrolls), but one similar to what I have, but for the first column.
EDIT: I've done it: jsfiddle example
- Possible duplicate of: stackoverflow./questions/1030043/… – Quasdunk Commented Sep 15, 2011 at 15:30
- Not a duplicate. I need BOTH the first row and the first column to stay visible. I could't find an answer to this on stackoverflow. – radonys Commented Sep 15, 2011 at 15:34
- 1 There are a lot of working JS solutions out on the web. For example datatables – what you are searching for is a bination of the "FixedColumns" and the "FixedHeader" plug-ins (if using jQuery-datatables). BTW: your solution flickers heavy while scrolling. – feeela Commented Sep 15, 2011 at 15:44
- Note that if you keep scrolling in your example the result flips from bottom of table back to top – mrtsherman Commented Sep 15, 2011 at 19:10
- @mrtsherman You're right, the code is not perfect... – radonys Commented Sep 15, 2011 at 20:52
2 Answers
Reset to default 3Using JS seems to be a bit overkill for this solution. Working with tables can be a pain in the neck, but there's a CSS property called position: fixed
which could be used for this purpose. I've put together a demo which isn't 100% perfect when it es to lining things up, but it demonstrates how to use it for your application.
DEMO: http://wecodesign./demos/stackoverflow-7433377.htm
For those interested, I fixed the flickering and the flipping, and the result is now perfect (for me). (jsfiddle example)
本文标签: javascriptKeeping the row title and column title of a table visible while scrollingStack Overflow
版权声明:本文标题:javascript - Keeping the row title and column title of a table visible while scrolling - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745660458a2161858.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论