ScrollIntoView使用方法:
document.querySelector('id').scrollIntoView({
behavior: "smooth", block: "nearest", inline: "nearest"
});
导致页面上移解决方法:
将最外层div设置为固定定位
div{
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
}
ScrollIntoView使用方法:
document.querySelector('id').scrollIntoView({
behavior: "smooth", block: "nearest", inline: "nearest"
});
导致页面上移解决方法:
将最外层div设置为固定定位
div{
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
}