Jquery Scrolling Table Keep Header Fixed Stack Overflow

Jquery Scrolling Table Keep Header Fixed Stack Overflow You would do something like this by tapping into the scroll event handler on window, and using another table with a fixed position to show the header at the top of the page. var $header = $("#table 1 > thead").clone(); var $fixedheader = $("#header fixed").append($header); var offset = $(this).scrolltop();. However, when i set overflow x: auto on the .content container to allow horizontal scrolling, the sticky behavior of the header breaks, and it no longer remains fixed at the top. what i tried: i applied position: sticky; top: 0; to the thead to keep it fixed.

Jquery Self Scrolling Html Table With Fixed Header Stack Overflow Overflow y: auto; on the
elements makes the header row "stick" to the top of the viewport as the user scrolls. top: 0; ensures the header remains at the very top. Here is my solution for a fixed table header with scrollable body and aligning columns. the requirements i wanted to achieve were: fix while | can scroll while. The fixed header element will keep the same table group container as original table (such as thead or tbody). the fixed header is just cloned from the original table. For the most part, in order to gain the fixed header, you need to implement fixed height width columns because most solutions involve using two separate tables, one for the header which will float and stay in place over the second table that contains the data.
---|
Comments are closed.