fix: 目录弹窗滚动事件阻止冒泡,防止触发内容区域滚动

This commit is contained in:
李策 2026-03-26 18:06:49 +08:00
parent 76f39363a0
commit bad2cb6c7a

View File

@ -622,6 +622,25 @@
}
});
// 阻止目录弹窗的滚动事件冒泡到页面
const tocList = document.getElementById('tocList');
tocList.addEventListener('wheel', (e) => {
e.stopPropagation();
}, { passive: true });
tocList.addEventListener('touchmove', (e) => {
e.stopPropagation();
}, { passive: true });
// 阻止弹窗内容区域的滚动冒泡
document.querySelector('.toc-content').addEventListener('wheel', (e) => {
e.stopPropagation();
}, { passive: true });
document.querySelector('.toc-content').addEventListener('touchmove', (e) => {
e.stopPropagation();
}, { passive: true });
// 初始化 - 等待app.js加载章节数据
document.addEventListener('DOMContentLoaded', async function() {
// 等待章节数据加载完成