FixHeader Plugin Question
FixHeader Plugin Question
Hello I'm trying to use this plugin option: https://datatables.net/reference/option/fixedHeader
And it's working, however I would like it to start sticking at a point that is not the top of the scrolling window.
I adjusted the CSS to make the header appear where I want to when it does stick, but I want to adjust the spot when it starts sticking, because the content of the page will be behind a sticky header on the site.
This is the CSS that I have:
table.fixedHeader-floating{position:fixed !important; background-color:white; top:170px !important; }
But how do I also make the script think that 170px from the top is where it should think that it's reached the top of the document.
Here is the live site: http://www.sealanddesign.com/page/fluid-compatibility
As you scroll more and more the table header eventually does "stick" just under the site header, but I want it to start sticking earlier than that. I can't find any options about this FixedHeader plugin that let me adjust that.
Thank you for any advice.
This question has an accepted answers - jump to answer
Answers
I tried to adjust some items in the script but that did not really do anything.
I figured it out. I was able to hardcode the offset inside the javascript file:
The value that needs to be set is headerOffset:
Find that and add the value as needed.
Is there a way to make the Page Length and Filter options or other options at the DOM top of the table stick when the FixedHeader is applied? That would be a nice feature.
FixedHeader has a
fixedHeader.headerOffset
option - you shouldn't need to modify the code in FixedHeader itself.There is also an automatic offset option, as shown in this example.
Not at this time - sorry. That is something that I will consider for future.
Allan