标题点击只打开一个面板

This commit is contained in:
fish
2026-07-24 15:41:46 +08:00
parent b876b6f91d
commit 5e05a37c5d
2 changed files with 2 additions and 0 deletions
+1
View File
@@ -182,6 +182,7 @@ function toggleSection(id) {
document.getElementById(id).classList.toggle('collapsed'); document.getElementById(id).classList.toggle('collapsed');
} }
function openSection(id) { function openSection(id) {
document.querySelectorAll('.section').forEach(function(s) { s.classList.add('collapsed'); });
var el = document.getElementById(id); var el = document.getElementById(id);
el.classList.remove('collapsed'); el.classList.remove('collapsed');
el.scrollIntoView({ behavior: 'smooth', block: 'start' }); el.scrollIntoView({ behavior: 'smooth', block: 'start' });
+1
View File
@@ -182,6 +182,7 @@ function toggleSection(id) {
document.getElementById(id).classList.toggle('collapsed'); document.getElementById(id).classList.toggle('collapsed');
} }
function openSection(id) { function openSection(id) {
document.querySelectorAll('.section').forEach(function(s) { s.classList.add('collapsed'); });
var el = document.getElementById(id); var el = document.getElementById(id);
el.classList.remove('collapsed'); el.classList.remove('collapsed');
el.scrollIntoView({ behavior: 'smooth', block: 'start' }); el.scrollIntoView({ behavior: 'smooth', block: 'start' });