Define a number of pixels, from the top of the table where the sticky header will appear
Is there any way to define a number of pixels, from the top of the table where the sticky header will appear? There is an option to do that to hide table when you scroll to the bottom of the table. But I have fixed nav bar and I need sticky header to appear before it's scrolled to the top of the browser's window. How can I do this?
This functionality is not built into the table, but the source code can be easily modified to accommodate this. All you need to change is:
- the JS logic that dictates when the table header is "floated" when a certain scroll position is reached (simply take into account the additional height of the fixed nav bar)
- the CSS style so that the
topcoordinates take into account the height of the fixed nav bar
Hi @terrymun :)
Thanks for your reply. Sorry I just found it :)
I added this:
var mainHeaderheight = jQuery('.vg-header').height(); var wpAdminHeight = jQuery('#wpadminbar').height(); var calcHeight = mainHeaderheight + wpAdminHeight;
and then:
if ($w.scrollTop() > $t.offset().top - calcHeight && $w.scrollTop() < $t.offset().top + $t.outerHeight() - allowance)
Original header now hides ok, but there's that jumpy effect that I can't get rid of.
You can have a look yourself :) http://screencast-o-matic.com/watch/cbflQmXVdO
Please help, thanks :)