scrollIntoView({
behavior:auto //定義動畫過渡效果"auto"或 "smooth" 之一。默認為 "auto"。
block:start//定義垂直方向的對齊, "start", "center", "end", 或 "nearest"之一。默認為 "start"。
inline:nearest//"start", "center", "end", 或 "nearest"之一。默認為 "nearest"。
})
用法:
/* 將頁面中的 某個元素 滾動到頂部 */
document.querySelector('.app-container').scrollIntoView({
behavior: 'smooth'
})