Scroll,Position

The solution for “Scroll,Position” can be found here. The following code will assist you in solving the problem.

import { HostListener } from ‘@angular/core’;

@ViewChild(‘curtain’) divCurtain: ElementRef;

export class ComponentX {
@HostListener(‘window:scroll’, [‘$event’]) onScrollEvent($event) {
console.log(window.pageYOffset);
this.divCurtain.nativeElement.style.top = window.pageYOffset.toString().concat(‘px’);
}

ngOnInit(): void { }
}

Thank you for using DeclareCode; We hope you were able to resolve the issue.

More questions on [categories-list]

0
inline scripts encapsulated in