I am facing an issue with my code snippet:
this.currentScrollYSub = Observable.fromEvent(window, 'scroll')
.throttleTime(5)
.subscribe(e => {
this.scrollY = window.scrollY;
console.log(window.scrollY); // Result: undefined
});
Although it works perfectly fine on Chrome, I have observed that it does not function properly on Internet Explorer 10 and Internet Explorer 11.
Any suggestions on how I can get this to work on Internet Explorer 11?
EDIT
I even attempted the following approach:
@HostListener('window:scroll', ['$event'])
track(event) {
console.debug("Scroll Event ", document.body.scrollTop); // Result: "Scroll Event 0"
}
@HostListener('window:scroll', ['$event'])
track(event) {
console.debug("Scroll Event ", this.scrollY);// Result: "Scroll Event undefined"
}