Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possibility to make header ruler sticky #88

Open
grigorijski opened this issue Nov 2, 2021 · 2 comments
Open

Possibility to make header ruler sticky #88

grigorijski opened this issue Nov 2, 2021 · 2 comments

Comments

@grigorijski
Copy link

Is it possible to make header with dates stick to the top during scrolling the timeline down?
So dates matching the row are always visible

Thank you!

@der-robert
Copy link

der-robert commented Oct 22, 2022

Sticky Header + horizontal scrolling, just adjust the values (365 if you have a sidebar) and the 60px if jou have a top navigation bar.

Just quick and dirty :-)

$('.jqtl-container').on('scroll',function() {
        let leftpx = (this.scrollLeft - 356)*-1;
        $(".is_fixed").css({
            left: leftpx+'px'
        });
});

$(window).on('scroll',function(){
        let el = $('.jqtl-ruler-top');
        if ($(this).scrollTop() > 200 && !el.hasClass("is_fixed")){
            el.css({ 'position': 'fixed', 'top': '60px' }).addClass("is_fixed");
        }
        if ($(this).scrollTop() < 200 && el.hasClass("is_fixed")){
            el.css({ 'position': 'static', 'top': '0px' }).removeClass("is_fixed");
        }
});

@vovka93
Copy link

vovka93 commented Apr 28, 2023

Working for me

$('.jqtl-container').on('scroll', function () {
  if ($('.jqtl-ruler-top').hasClass("is_fixed")) {
    $(".is_fixed").css({ left: ($('.jqtl-main').position().left + 1) + 'px' });
  }
});
$(window).on('scroll', function () {
  let el = $('.jqtl-ruler-top');
  let offset = 160;
  if ($(this).scrollTop() > offset && !el.hasClass("is_fixed")) {
    $('.jqtl-main').css({ 'padding-top': el.outerHeight() });
    el.css({ 'position': 'fixed', 'top': '0px', left: ($('.jqtl-main').position().left + 1) + 'px' }).addClass("is_fixed");
  }
  if ($(this).scrollTop() < offset && el.hasClass("is_fixed")) {
    $('.jqtl-main').css({ 'padding-top': 0 });
    el.css({ 'position': 'static', 'top': '0px' }).removeClass("is_fixed");
  }
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants