Scrollable Table using jQuery

a 夏天 提交于 2019-12-22 10:42:55

问题


Is there any good and light jQuery plugin out there make Scrollable Tables.

I got one at http://www.webtoolkit.info/scrollable-html-table-plugin-for-jquery.html but that won't working non-IE and non-FF browsers.

Thanks!


回答1:


If you're looking for light code, skip the jQuery altogether and use pure HTML/CSS:

<table>
    <thead>
        <tr><th>Header Item 1</th><th>Header Item 2</th></tr>
    </thead>
    <tfoot>
        <tr><th>Footer Item 1</th><th>Footer Item 2</th></tr>
    </tfoot>
    <tbody style="overflow-y: scroll; overflow-x: hidden; height: 100px;">
        <tr><td>Item 1-1</td><td>Item 2-1</td></tr>
        ...
        <tr><td>Item 1-N</td><td>Item 2-N</td></tr>
    </tbody>
</table>

The key is in setting the overflow CSS in tbody, so as to make that part scrollable (but not the entire table). You'll also need to set the height, so you can define how tall the scrollable section should be.




回答2:


Here's one that works well: http://www.farinspace.com/jquery-scrollable-table-plugin/

And since it was mentioned above, here's a pure HTML/CSS cross-browser solution: http://www.imaputz.com/cssStuff/bigFourVersion.html



来源:https://stackoverflow.com/questions/583102/scrollable-table-using-jquery

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!