I designed a chat interface and did the animations on webflow natively using on page load. i want the chat to scroll automatically when new messages appear. can you pls suggest a code for that? thank you for your help
You can achieve automatic scrolling in your Webflow chat interface by using JavaScript to detect when new messages appear and then adjusting the scroll position of the chat container. The script should observe changes in the message list and update the scrollTop property to ensure the latest message is always visible. You can implement this by using a MutationObserver to track new messages being added and then smoothly scroll the chat container to its maximum height. Make sure to apply this script within an embed block inside Webflow, targeting the correct class for your chat wrapper. If you need any help in the coding part would be happy to assist you.