Page Content: Fix replace header behaviour

This commit is contained in:
Konstantinos Triantafyllou 2022-08-31 13:15:49 +03:00
parent 00868405c8
commit 7bb2346ec2
1 changed files with 4 additions and 2 deletions

View File

@ -127,9 +127,11 @@ export class PageContentComponent implements OnInit, AfterViewInit, OnDestroy {
if (this.header) {
let headerObs = new IntersectionObserver(entries => {
entries.forEach(entry => {
this.layoutService.setReplaceHeader(!entry.isIntersecting);
if(entry.boundingClientRect.height > 0) {
this.layoutService.setReplaceHeader(!entry.isIntersecting);
}
})
}, {threshold: 0.5});
});
this.subscriptions.push(headerObs);
headerObs.observe(this.header.nativeElement);
}