Javascript 调整scrollIntoView的持续时间

Javascript 调整scrollIntoView的持续时间,javascript,animation,duration,smooth-scrolling,Javascript,Animation,Duration,Smooth Scrolling,我正在使用JS使用锚标记和ID平滑滚动,我想调整平滑滚动动画的持续时间 这是我的密码: let anchorlinks=document.querySelectorAll('a[href^=“#”]”) 用于(锚链项目){ item.addEventListener('单击',(e)=>{ 让hashval=item.getAttribute('href') 让target=document.querySelector(hashval) target.scrollIntoView({ 行为:“

我正在使用JS使用锚标记和ID平滑滚动,我想调整平滑滚动动画的持续时间

这是我的密码:

let anchorlinks=document.querySelectorAll('a[href^=“#”]”)
用于(锚链项目){
item.addEventListener('单击',(e)=>{
让hashval=item.getAttribute('href')
让target=document.querySelector(hashval)
target.scrollIntoView({
行为:“平滑”,
块:“开始”,
持续时间:200
})
history.pushState(null、null、hashval)
e、 预防默认值()
})
}