scrollIntoView({
behavior:auto //定義動(dòng)畫過渡效果"auto"或 "smooth" 之一秧倾。默認(rèn)為 "auto"傀缩。
block:start//定義垂直方向的對(duì)齊, "start", "center", "end", 或 "nearest"之一赡艰。默認(rèn)為 "start"。
inline:nearest//"start", "center", "end", 或 "nearest"之一慷垮。默認(rèn)為 "nearest"。
})
用法:
/* 將頁面中的 某個(gè)元素 滾動(dòng)到頂部 */
document.querySelector('.app-container').scrollIntoView({
behavior: 'smooth'
})