js滚动条自动划到最底部

const divs = document.getElementById('templateModel')
divs.scrollTop = divs.scrollHeight
 
2024-1-24更新
对话问答时,自动滚动到最下面一条对话。
  const scrollToBottom = useCallback(() => {
    const element = document.querySelector('div[class^=Container]:last-child');
    if (element) {
      element.scrollIntoView({
        block: 'end',
        inline: 'nearest',
        behavior: 'smooth',
      });
    }
  }, []);

 

posted @ 2023-03-13 11:45  吾本人间一叶茶  阅读(1059)  评论(0编辑  收藏  举报
Live2D