Skip to content
Advertisement

How to programmatically scroll to bottom of a div while using Simplebar js

I am using Simplebar and angular 1 and I need to scroll to the bottom of a chatbox (div) whenever there is a new message or when you click on the menu item.

Here is my scroll function in my chatController.js

JavaScript

And here is my html

JavaScript

I’m gaining this error:

JavaScript

I am also using a flexbox layout to keep the messages on the bottom (this also isn’t working since simplebar. but i’m taking on 1 problem at the time)

Advertisement

Answer

Use this

JavaScript

You can replace body according to your dom element

Advertisement