window.scrollTo({
top: 600,
behavior:'smooth'
})
window.scrollTo(options)方法,options是一个对象,有三个属性:
top 等同于 y-coord
left 等同于 x-coord
behavior 类型String,表示滚动行为,支持参数 smooth(平滑滚动),instant(瞬间滚动),默认值auto(等同于instant)
window.scrollTo({
top: 600,
behavior:'smooth'
})
window.scrollTo(options)方法,options是一个对象,有三个属性:
top 等同于 y-coord
left 等同于 x-coord
behavior 类型String,表示滚动行为,支持参数 smooth(平滑滚动),instant(瞬间滚动),默认值auto(等同于instant)