This commit is contained in:
tiago.kayaya
2021-09-24 15:39:25 +01:00
parent 77cb5ad73b
commit 45197375ff
6 changed files with 107 additions and 11 deletions
@@ -49,6 +49,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
capturedImage:any;
capturedImageTitle:any;
attendees: EventPerson[] = [];
scrollToBottomBtn = false;
@ViewChild('scrollMe') private myScrollContainer: ElementRef;
@@ -103,17 +104,24 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
window.addEventListener('scroll', this.scrollChangeCallback, true);
}
onContentScrolled(e) {
onContentScrolled(e) {
this.startPosition = e.srcElement.scrollTop;
let scroll = e.srcElement.scrollTop;
let windowHeight = e.srcElement.scrollHeight;
let containerHeight = windowHeight - 596.59997558594;
if (scroll > this.currentPosition) {
//this.showButton = false;
//alert('BOTTOM');
} else {
//this.showButton = true;
//alert('UP');
this.scrollingOnce = false;
}
if((containerHeight - 100) > scroll){
this.scrollToBottomBtn = true;
}
else{
this.scrollToBottomBtn = false;
}
this.currentPosition = scroll;
}
@@ -130,6 +138,12 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
} catch(err) { }
}
scrollToBottomClicked(): void {
try {
this.myScrollContainer.nativeElement.scrollTop = this.myScrollContainer.nativeElement.scrollHeight;
} catch(err) { }
}
getRoomInfo(){
this.showLoader = true;
this.chatService.getRoomInfo(this.roomId).subscribe(room=>{