StickySort icon indicating copy to clipboard operation
StickySort copied to clipboard

Define a number of pixels, from the top of the table where the sticky header will appear

Open rolka opened this issue 8 years ago • 2 comments

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?

rolka avatar Mar 09 '17 08:03 rolka

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 top coordinates take into account the height of the fixed nav bar

terrymun avatar Mar 15 '17 22:03 terrymun

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 :)

rolka avatar Apr 12 '17 10:04 rolka