From c3acaea5e2e8b835f0443954acf4385956bf7ecb Mon Sep 17 00:00:00 2001 From: nanhaoluo <3075912108@qq.com> Date: Fri, 23 Jan 2026 15:37:57 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=A7=BB=E9=99=A4important=E5=B9=B6?= =?UTF-8?q?=E9=80=9A=E8=BF=87=E7=A6=81=E7=94=A8transition=E8=A7=A3?= =?UTF-8?q?=E5=86=B3=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 找到根本原因:post-preview的transition: all导致opacity被动画恢复 - 解决方案:临时禁用transition,设置opacity,然后恢复 - 添加footer隐藏功能 - 让被点击的卡片居中显示 - 清理时恢复footer和卡片位置 --- argontheme.js | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/argontheme.js b/argontheme.js index 873e905..43cb175 100644 --- a/argontheme.js +++ b/argontheme.js @@ -2832,9 +2832,28 @@ $(document).pjax("a[href]:not([no-pjax]):not(.no-pjax):not([target='_blank']):no $card.addClass("post-pjax-loading"); $("#main").addClass("post-list-pjax-loading"); - // 强制隐藏其他卡片 - 使用attr设置style以添加!important + // 隐藏其他卡片 - 先禁用transition,设置opacity,然后恢复 $(".post-preview").not($card).each(function() { - $(this).attr('style', ($(this).attr('style') || '') + ' opacity: 0 !important; pointer-events: none !important;'); + let $this = $(this); + let originalTransition = $this.css("transition"); + $this.css("transition", "none"); + $this.css("opacity", "0"); + $this.css("pointer-events", "none"); + // 强制浏览器重绘 + $this[0].offsetHeight; + $this.css("transition", originalTransition); + }); + + // 隐藏footer + $("#footer").css({ + "opacity": "0", + "pointer-events": "none" + }); + + // 让被点击的卡片居中 + $card.css({ + "margin-left": "auto", + "margin-right": "auto" }); let offsetTop = $($card).offset().top - $("#main").offset().top; @@ -2867,11 +2886,19 @@ $(document).pjax("a[href]:not([no-pjax]):not(.no-pjax):not([target='_blank']):no "transform": "", "transition": "", "left": "", - "width": "" + "width": "", + "margin-left": "", + "margin-right": "" }); $(".post-preview .loading-css-animation").remove(); $("#main").removeClass("post-list-pjax-loading"); + // 恢复footer + $("#footer").css({ + "opacity": "", + "pointer-events": "" + }); + // 更新 UI 状态 if ($("#post_comment", dom[0]).length > 0){ $("#fabtn_go_to_comment").removeClass("d-none");