samedi 28 juillet 2018

Angular - Event OnScroll

I'm developing an application in angular 4. Also I'm using Firefox and everything works fine, I can handle the scroll event like this:

@HostListener('window:scroll', ['$event']) onScrollEvent($event) {

        let posY = $event.pageY;
}

The posY starts from 0 which is fine.

But now I'm testing the same application in Google Chrome or Safari and I get "pageY undefined"

I was looking at google that Chrome and Safari not handle PageY. Is there any way to get this value using angular ?

Thanks

UPDATE:

I also tried

console.log($event.target.body.scrollTop);

but keep me showing 0




Aucun commentaire:

Enregistrer un commentaire