Skip to content

Commit

Permalink
fix: set scrolled attribute only when offset is larger than the header (
Browse files Browse the repository at this point in the history
#2133)

* fix: set scrolled attribute only when offset is larger than the header
  • Loading branch information
felix-ico authored Sep 22, 2023
1 parent ae354cf commit df45405
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ export class TelekomHeader {

@Listen('scroll', { target: 'document' })
onScroll() {
this.scrolled = window.pageYOffset > 2;
// 48px is the height of the header, set scrolled when the user scrolls past it
// todo: calculate this value dynamically (for slim header, smaller viewports, etc)
this.scrolled = window.pageYOffset > 48;
this.scrolledBack =
this.pageYOffset !== window.pageYOffset && window.pageYOffset <= 0;
this.pageYOffset = pageYOffset;
Expand Down

0 comments on commit df45405

Please sign in to comment.