add scroll bar to table body

前端 未结 4 766
孤独总比滥情好
孤独总比滥情好 2020-12-07 23:16

I want to do this as easily as possible with out any additional libraries.

In my very long table I want to add a scrollbar to the tag so

4条回答
  •  独厮守ぢ
    2020-12-07 23:43

    These solutions often have issues with the header columns aligning with the body columns, and may not work properly when resizing. I know you didn't want to use an additional library, but if you happen to be using jQuery, this one is really small. It supports fixed header, footer, column spanning (colspan), horizontal scrolling, resizing, and an optional number of rows to display before scrolling starts.

    jQuery.scrollTableBody (GitHub)

    As long as you have a table with proper , , and (optional) , all you need to do is this:

    $('table').scrollTableBody();
    

提交回复
热议问题