Sticky header jumps on fast scrolling

Viewed 489

I have problem with sticky header. I have placeholder to keep good height when i am scrolling and it's working fine. Problem appear when i scroll faster. I read that jquery scroll position by 1-2-4-12.. pixels at once and by it my sticky header stick not on position i wanted what couse something like jump or blink.

scroll() {
  let queryWindow = Ember.$(window);
  let siteBarHeight = Ember.$('.folded').offset() ? 19 : 47;

  queryWindow.scroll(() => {
    let fixedHeader = this.get('fixedHeader');
    let shouldBeFixed = queryWindow.scrollTop() > 90 + siteBarHeight;

    if (!fixedHeader && shouldBeFixed) {
      this.set('fixedHeader', true);
    } else if (fixedHeader && !shouldBeFixed) {
      this.set('fixedHeader', false);
    }
  });
}

This all working fine when my scroll slowly, but in other way jquery stick it too late. Thanks in advance for helping me, tell me if you need more information about it.

0 Answers
Related