标题点击可关闭面板

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