On horizontal scroll for a table, how can I have sticky th until reach the next th?

I have a table with a horizontal scrollbar. I need to make the data of the first two rows sticky when horizontally scroll the table.
This is the table at the first place:

enter image description here

When I scroll I want “2016” and “Dec” to be displayed until I reach “2017” and “Jan”, and the same for 2017 and Jan until I reach the next date.
This is the picture while scrolling:

enter image description here

and the picture when I reach the next date:

enter image description here

Please note that I don’t want numbers to be sticky.
I already used scrollToFixed library for vertical scroll, but i’m not sure if it works in my situation.
Any hints will be appreciated.

7 thoughts on “On horizontal scroll for a table, how can I have sticky th until reach the next th?”

Leave a Comment