Skip to content

Commit

Permalink
Fix for scrolling bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Jukka Puranen committed Sep 25, 2023
1 parent fde1ebb commit 4a9299e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion BlazorApp/Pages/Chat.razor
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
{
if (_currentSession != null && _currentSession.Entries.Count > 0)
{
await JS.InvokeVoidAsync("scrollToBottom");
await JS.InvokeVoidAsync("scrollToBottom", "chatInput");
}
await base.OnAfterRenderAsync(firstRender);
}
Expand Down
5 changes: 3 additions & 2 deletions BlazorApp/wwwroot/js/utils.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
window.scrollToBottom = function () {
window.scrollTo(0, document.documentElement.scrollHeight);
window.scrollToBottom = function (elementId) {
var element = document.getElementById(elementId);
element.scrollIntoView()
};

0 comments on commit 4a9299e

Please sign in to comment.