问题描述:

I have an angular2 application which has a header and the content is inside an iframe. I disabled the window scrollbar inside the css file with: html {overflow-y: hidden;} and my goal is to achive a sticky header with an animation.

I tried some options, but in my opinion none of them are fireing / listening to the scroll event of the iframe (window or doscument scroll event is fireing without problems, but I do not need it):

option 1 (when I try (load) instead of (scroll), it works):

<iframe src=".." scrolling="yes" (scroll)="iframeScrollHandler(event)">..</iframe>

option 2:

@ViewChild('iframe') iframe: ElementRef;

constructor(@Inject(DOCUMENT) private document: Document, private window: Window, private renderer:Renderer) {

}

ngAfterViewInit(){

this.renderer.listen(this.iframe.nativeElement, 'scroll', (event) => {

console.log('scroll scroll..');

})

}

Do you know why the scroll event is not fireing?

相关阅读:
Top