Enable automatic scrolling in ionic


#1

I have a project to show some data in ionic 3. Data is loaded from the remote source such as firestore. I can load data without any Problem.
My requirement is enable autoscrolling.When scrolling ends it starts again from the top.
but I couldn’t make even the auto-scrolling using the scrollTobottom().

Why I couldn’t make an automatic scrolling using scrollTobottom().

can someone please explain it and please give me a solution to it…?

Thanks in advance


#2

does anybody have a solution…?

i am stuck with this one…


#3

A function that scrolls the content every 5 seconds to a certain height, based on it, you can make a decision:

@ViewChild(Content) content: Content;

...

scrollToBottom() {
	setTimeout(() => {
		if (this.isScroll && this.content.getContentDimensions().scrollHeight && this.content.contentHeight && this.content.getContentDimensions().scrollHeight > this.content.contentHeight * this.scrollIdx) {
			this.content.scrollTo(0, this.content.contentHeight * this.scrollIdx, 300);
			this.scrollIdx++;
			this.scrollToBottom();
		}
	}, 5000);
}

#4

Thanks for your valuable response…

lets check it out