I needed to be able to have the sticky thead functionality inside an absolutely scrolling div container. Originally the scroll listeners were set to the window and the top position was always set to 0.
I've added an options object with the following properties available:
scrollContainer - default window. A HTML element that should be used when calculating scroll top offsets for the positioning of the fixed thead element.
offsetTopOverride - default unused. An integer value overriding the offsetTop which is used to calculate when the thead should start being fixed when scrolling. Sometimes you may want to start the fixed scrolling immediately or after a set number of pixes. For example the table I was using it with had an extra row under the header with search filter information.
I needed to be able to have the sticky
thead
functionality inside an absolutely scrolling div container. Originally the scroll listeners were set to thewindow
and thetop
position was always set to 0.I've added an
options
object with the following properties available:scrollContainer
- defaultwindow
. A HTML element that should be used when calculating scroll top offsets for the positioning of the fixedthead
element.offsetTopOverride
- default unused. An integer value overriding theoffsetTop
which is used to calculate when thethead
should start being fixed when scrolling. Sometimes you may want to start the fixed scrolling immediately or after a set number of pixes. For example the table I was using it with had an extra row under the header with search filter information.