Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
<a *ngIf="windowScrolled" (click)="scrollUp()">
<span class="scroll-top">
import { DOCUMENT } from '@angular/common';
windowScrolled: boolean;
lamp = faLightbulb;
private localStorageService: LocalStorageService,
@Inject(DOCUMENT) private document: Document) {
@HostListener('window:scroll', [])
onWindowScroll() {
this.windowScrolled = window.pageYOffset > 250 ? true : false;
scrollUp() {
document.querySelector('nav').scrollIntoView({ behavior: 'smooth', block: 'start' });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.