如何实现页面刷新后不定位到之前的滚动位置?
if (history.scrollRestoration) { history.scrollRestoration = 'manual'; }
button.onclick = function () {
if (history.scrollRestoration) {
history.scrollRestoration = 'manual';
}
}
来源:
https://www.zhangxinxu.com/wordpress/2022/05/history-scrollrestoration/