Skip to content

Commit a4e23a1

Browse files
fix(scroll direction calculate): add logic for no scroll change
scroll direction not updated when no change in scroll Y
1 parent c65c710 commit a4e23a1

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/app/scroll-collapse/scroll-collapse.directive.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,10 @@ export class ScrollCollapseDirective implements AfterViewInit, OnDestroy {
175175
public calculateScrollDirection(events: Viewport[]): void {
176176
const pastEvent = events[0];
177177
const currentEvent = events[1];
178+
const noScrollChange = pastEvent.scrollY === currentEvent.scrollY;
179+
if (noScrollChange) {
180+
return;
181+
}
178182
this.scrollDirection =
179183
pastEvent.scrollY > currentEvent.scrollY ? Direction.UP : Direction.DOWN;
180184
}

0 commit comments

Comments
 (0)