前端页面滚动到指定节点

	// 获取根元素
	let content = document.querySelector('.list-space')
	// 获取目标元素
	let targetEle = document.querySelector(`#type-id-${chatState.chatData.length - 1}`)
	content.scrollTo({
		top: targetEle.offsetTop - 20,
		behavior: 'smooth'
	})
posted @ 2024-03-20 15:57  Felix_Openmind  阅读(46)  评论(0)    收藏  举报
*{cursor: url(https://files-cdn.cnblogs.com/files/morango/fish-cursor.ico),auto;}