Skip to content

Commit

Permalink
fix(scroll direction calculate): add logic for no scroll change
Browse files Browse the repository at this point in the history
scroll direction not updated when no change in scroll Y
  • Loading branch information
jackhkmatthews committed May 31, 2018
1 parent c65c710 commit a4e23a1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/app/scroll-collapse/scroll-collapse.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,10 @@ export class ScrollCollapseDirective implements AfterViewInit, OnDestroy {
public calculateScrollDirection(events: Viewport[]): void {
const pastEvent = events[0];
const currentEvent = events[1];
const noScrollChange = pastEvent.scrollY === currentEvent.scrollY;
if (noScrollChange) {
return;
}
this.scrollDirection =
pastEvent.scrollY > currentEvent.scrollY ? Direction.UP : Direction.DOWN;
}
Expand Down

0 comments on commit a4e23a1

Please sign in to comment.