fix(settings): 切换子页面时将共享滚动容器归零
设置界面各子页面同处于唯一的滚动容器 #content-container 内,切页仅切换 display 而未重置 scrollTop,导致在某页滚动后切到其他页时新页面会停留在 上一页的滚动偏移处。切页显示新模块后将 #content-container.scrollTop 归零。
This commit is contained in:
1 parent
c8a71ef141
commit
2b2a546bcf
1 file changed
+6
@@ -70,6 +70,12 @@ export function showOnlyCurrentModule(moduleName: string): void {
|
||||
}
|
||||
|
||||
next.style.display = 'block';
|
||||
// 各子页面共用同一个滚动容器 #content-container,切页时需要把滚动位置归零,
|
||||
// 否则新页面会停留在上一个页面的滚动偏移处。
|
||||
const scrollContainer = document.getElementById('content-container');
|
||||
if (scrollContainer) {
|
||||
scrollContainer.scrollTop = 0;
|
||||
}
|
||||
activeModuleName = moduleName;
|
||||
// 词库 / 实用功能的浮层挂在 body 下(见 hoistOverlay),不随模块容器一起隐藏,切页时收起
|
||||
dismissHoistedOverlays();
|
||||
|
||||
Reference in new issue
Block a user