我试图使页脚滑动/退出取决于滚动。到目前为止,我唯一要做的就是用psYReachEnd来显示页脚,但是当我滚动前100 ex时,我如何“告诉”页脚滑回去呢?
public onReachEnd(): void {
this.zone.run(() => {
this.status = true;
});
console.log('show footer');}
<perfect-scrollbar (psYReachEnd)="onReachEnd()"><div>content</div><div id="footer" class="container-fluid" [ngClass]="status ? 'show' : 'hide'">footer content</div></perfect-scrollbar>发布于 2019-10-09 13:50:22
最后发现它是out.If,其他人都感兴趣,这里是工作解决方案(对我来说)
constructor(private zone: NgZone) {}
status = false;
@HostListener('scroll', ['$event'])
onScrollY(event) {
if (event.target.offsetHeight + event.target.scrollTop >= event.target.scrollHeight) {
this.zone.run(() => {
this.status = true;
});
} else {
this.zone.run(() => {
this.status = false;
});
}
}
<perfect-scrollbar (psScrollY)="onScrollY($event)">
<div [ngClass]="status ? 'show' : 'hide'">content</div>
</perfect-scrollbar>ps:如果有更多的角度解决方案,请张贴
https://stackoverflow.com/questions/58285803
复制相似问题