scrollToBottom
Scrolls the chat view to the bottom to show the latest messages.
Example
<div id="chat"></div>
<script>
let messagesData = [
{
id: 1,
text: "This is the first message at the top.",
authorId: "user1",
authorName: "John Doe",
authorImageUrl: "https://demos.telerik.com/kendo-ui/content/web/Customers/RICSU.jpg",
timestamp: new Date(2026, 0, 1, 9, 0)
},
{
id: 2,
text: "Here's another message in the middle.",
authorId: "user2",
authorName: "Jane Smith",
authorImageUrl: "https://demos.telerik.com/kendo-ui/content/web/Customers/LONEP.jpg",
timestamp: new Date(2026, 0, 1, 9, 5)
},
{
id: 3,
text: "And this is the latest message. The chat will scroll to show this message.",
authorId: "user1",
authorName: "John Doe",
authorImageUrl: "https://demos.telerik.com/kendo-ui/content/web/Customers/RICSU.jpg",
timestamp: new Date(2026, 0, 1, 9, 10)
}
];
let chat = $("#chat").kendoChat({
authorId: "user1",
dataSource: messagesData,
height: 300 // Limited height to demonstrate scrolling
}).data("kendoChat");
// Scroll to bottom after 2 seconds
setTimeout(function() {
chat.scrollToBottom();
}, 2000);
</script>
In this article