fix: 修复评论跳转按钮只展开不滚动的问题
- 折叠状态下先滚动到评论切换按钮位置,再展开评论区 - 已展开状态下直接滚动到评论框 - 解决折叠时 #post_comment 高度为 0 导致位置计算错误的问题
This commit is contained in:
@@ -715,22 +715,28 @@ if (argonConfig.waterflow_columns != "1") {
|
|||||||
$("#fabtn_go_to_comment").addClass("d-none");
|
$("#fabtn_go_to_comment").addClass("d-none");
|
||||||
}
|
}
|
||||||
$goToComment.on("click" , function(){
|
$goToComment.on("click" , function(){
|
||||||
// 如果评论区是折叠状态,先展开
|
|
||||||
var commentsArea = $("#comments");
|
var commentsArea = $("#comments");
|
||||||
var postCommentArea = $("#post_comment");
|
var postCommentArea = $("#post_comment");
|
||||||
if (commentsArea.hasClass("comments-collapsed")) {
|
var wasCollapsed = commentsArea.hasClass("comments-collapsed");
|
||||||
commentsArea.removeClass("comments-collapsed");
|
|
||||||
setTimeout(function() {
|
if (wasCollapsed) {
|
||||||
postCommentArea.removeClass("comments-collapsed");
|
// 折叠状态:先滚动到评论切换按钮位置,再展开
|
||||||
}, 150);
|
|
||||||
var toggleBtn = $("#comments_toggle");
|
var toggleBtn = $("#comments_toggle");
|
||||||
if (toggleBtn.length > 0) {
|
if (toggleBtn.length > 0) {
|
||||||
|
gotoHash("#comments_toggle", 600);
|
||||||
toggleBtn.find("i").removeClass("fa-comments").addClass("fa-comment-o");
|
toggleBtn.find("i").removeClass("fa-comments").addClass("fa-comment-o");
|
||||||
toggleBtn.find(".btn-inner--text").text("折叠评论");
|
toggleBtn.find(".btn-inner--text").text("折叠评论");
|
||||||
}
|
}
|
||||||
}
|
commentsArea.removeClass("comments-collapsed");
|
||||||
|
setTimeout(function() {
|
||||||
|
postCommentArea.removeClass("comments-collapsed");
|
||||||
|
$("#post_comment_content").focus();
|
||||||
|
}, 150);
|
||||||
|
} else {
|
||||||
|
// 已展开:直接滚动到评论框
|
||||||
gotoHash("#post_comment" , 600);
|
gotoHash("#post_comment" , 600);
|
||||||
$("#post_comment_content").focus();
|
$("#post_comment_content").focus();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (localStorage['Argon_fabs_Floating_Status'] == "left"){
|
if (localStorage['Argon_fabs_Floating_Status'] == "left"){
|
||||||
|
|||||||
Reference in New Issue
Block a user