fix: 修复TODO在非停靠状态时不会折叠的问题

- 在所有关闭侧边栏的操作中添加折叠所有面板的逻辑
- 包括点击遮罩、关闭按钮、链接、搜索和目录跳转等场景
- 确保侧边栏关闭时所有折叠面板(TODO、文章目录等)都会自动收起
This commit is contained in:
2026-01-22 15:40:02 +08:00
parent 72c2e5b6cd
commit cb5c65d611

View File

@@ -2898,9 +2898,13 @@ $(document).on("click" , "#blog_categories .tag" , function(){
});
$(document).on("click" , "#sidebar_mask, #leftbar_close_btn" , function(){
$("html").removeClass("leftbar-opened");
// 关闭侧边栏时折叠所有面板
$(".leftbar-mobile-collapse-section.expanded").removeClass("expanded");
});
$(document).on("click" , "#leftbar a[href]:not([no-pjax]):not([href^='#']):not(.has-submenu)" , function(){
$("html").removeClass("leftbar-opened");
// 关闭侧边栏时折叠所有面板
$(".leftbar-mobile-collapse-section.expanded").removeClass("expanded");
});
// 移动端子菜单展开/收起
$(document).on("click" , ".leftbar-mobile-menu-item.has-children > a.has-submenu" , function(e){
@@ -2917,6 +2921,8 @@ $(document).on("click" , "#blog_categories .tag" , function(){
return;
}
$("html").removeClass("leftbar-opened");
// 关闭侧边栏时折叠所有面板
$(".leftbar-mobile-collapse-section.expanded").removeClass("expanded");
searchPosts(word);
});
$(document).on("click" , "#navbar_global.show .navbar-nav a[href]:not([no-pjax]):not([href^='#'])" , function(){
@@ -3020,6 +3026,8 @@ $(document).on("click" , "#blog_categories .tag" , function(){
// 点击后关闭侧边栏
setTimeout(function() {
$("html").removeClass("leftbar-opened");
// 关闭侧边栏时折叠所有面板
$(".leftbar-mobile-collapse-section.expanded").removeClass("expanded");
}, 150);
}
}