From d9aafe2479f2e46ffebaa62dfc68aff4aa92e01b Mon Sep 17 00:00:00 2001 From: nanhaoluo <3075912108@qq.com> Date: Fri, 16 Jan 2026 22:18:08 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E8=AF=84=E8=AE=BA?= =?UTF-8?q?=E5=9B=9E=E5=A4=8D=E6=8C=89=E9=92=AE=E7=82=B9=E5=87=BB=E6=97=A0?= =?UTF-8?q?=E5=8F=8D=E5=BA=94=E5=92=8C=E7=82=B9=E8=B5=9E=E6=95=B0=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将评论回复/编辑的滚动动画从 jQuery animate + easeOutCirc 改为原生 window.scrollTo - 避免因其他插件覆盖 jQuery 导致 easing 函数丢失的问题 - 修复 .comment-upvote .btn-inner--text 样式,确保点赞数正确显示 - 添加 display: inline-block !important 强制显示点赞数文本 --- argontheme.js | 32 ++++++++++++++++++++++---------- style.css | 3 +++ 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/argontheme.js b/argontheme.js index 727d4ec..b944b2b 100644 --- a/argontheme.js +++ b/argontheme.js @@ -996,12 +996,14 @@ if (argonConfig.waterflow_columns != "1") { $("#post_comment").addClass("post-comment-force-privatemode-off"); } - // 滚动到评论框(添加防护检查) + // 滚动到评论框(使用原生 scrollTo 避免 jQuery easing 依赖问题) let postComment = $('#post_comment'); if (postComment.length > 0 && postComment.offset()) { - $("body,html").animate({ - scrollTop: postComment.offset().top - 100 - }, 400, 'easeOutCirc'); + let targetTop = postComment.offset().top - 100; + window.scrollTo({ + top: targetTop, + behavior: 'smooth' + }); } // 使用 CSS 动画显示回复框 @@ -1063,9 +1065,14 @@ if (argonConfig.waterflow_columns != "1") { }else{ $("#post_comment").addClass("post-comment-force-privatemode-off"); } - $("body,html").animate({ - scrollTop: $('#post_comment').offset().top - 100 - }, 400, 'easeOutCirc'); + // 使用原生 scrollTo 避免 jQuery easing 依赖问题 + let postCommentEl = document.getElementById('post_comment'); + if (postCommentEl) { + window.scrollTo({ + top: postCommentEl.getBoundingClientRect().top + window.pageYOffset - 100, + behavior: 'smooth' + }); + } $("#post_comment_content").focus(); } function cancelEdit(clear){ @@ -1080,9 +1087,14 @@ if (argonConfig.waterflow_columns != "1") { edit(this.getAttribute("data-id")); }); $(document).on("click", "#post_comment_edit_cancel", function(){ - $("body,html").animate({ - scrollTop: $("#comment-" + editID).offset().top - 100 - }, 400, 'easeOutCirc'); + // 使用原生 scrollTo 避免 jQuery easing 依赖问题 + let commentEl = document.getElementById("comment-" + editID); + if (commentEl) { + window.scrollTo({ + top: commentEl.getBoundingClientRect().top + window.pageYOffset - 100, + behavior: 'smooth' + }); + } cancelEdit(true); }); $(document).on("pjax:click", function(){ diff --git a/style.css b/style.css index 2e619e6..df55c8f 100644 --- a/style.css +++ b/style.css @@ -5411,12 +5411,15 @@ html.darkmode .comment-operations { .comment-upvote .btn-inner--text { margin-left: 0 !important; + margin-right: 0 !important; font-variant-numeric: tabular-nums; + display: inline-block !important; } .comment-upvote .comment-upvote-num { min-width: 12px; text-align: center; + display: inline-block; } html.darkmode .comment-upvote {