Floating horizontal scroll bar for html table

后端 未结 2 1736
迷失自我
迷失自我 2021-01-20 15:39

I have an html table that is very tall. The web page has to be scrolled vertically to reach the scroll bar at the bottom of the table. It would be nice if I could float th

相关标签:
2条回答
  • 2021-01-20 16:02

    The Grid suggestion by @KDavid is good, but if you're looking for something a bit lighter I had success with the the floatingScrollbar jQuery plugin (demo).

    After making sure the plugin JS is loaded, the magic call happens:

    $('.your-div').floatingScrollbar();
    

    I also had to set the div CSS to:

    .your-div {
      overflow-x: auto;
      width: 100%;
    }
    

    Here is a fork of your jsFiddle with it working: http://jsfiddle.net/RxTQM/1/

    0 讨论(0)
  • 2021-01-20 16:16

    Yes, place it inside a <div> tag, and add overflow:scroll; to the style of the div.

    0 讨论(0)
提交回复
热议问题