From 916f5d17a56214e2bbe18b1e027ab3cbf64caf5d Mon Sep 17 00:00:00 2001 From: xiongxiaoyang <1179705413@qq.com> Date: Tue, 20 Oct 2026 07:46:42 +0800 Subject: [PATCH] =?UTF-8?q?fix(mobile):=20=E4=BF=AE=E5=A4=8D=E5=B0=8F?= =?UTF-8?q?=E8=AF=B4=E7=AD=9B=E9=80=89=E9=A1=B5=E4=B9=A6=E7=B1=8D=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E5=88=86=E9=A1=B5=E8=B7=B3=E8=BD=AC=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../templates/mobile/book/bookclass.html | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/novel-front/src/main/resources/templates/mobile/book/bookclass.html b/novel-front/src/main/resources/templates/mobile/book/bookclass.html index 4b1a2e4..f9d055f 100644 --- a/novel-front/src/main/resources/templates/mobile/book/bookclass.html +++ b/novel-front/src/main/resources/templates/mobile/book/bookclass.html @@ -395,7 +395,7 @@ .filter('[data-val="' + bookStatus + '"]').addClass('active'); } - function search(curr, limit) { + function search(curr, limit, fromPage) { var searchData = {}; @@ -481,6 +481,11 @@ } $("#bookList").html(bookListHtml); + // 分页跳页后自动滚到列表第一行(首屏加载不触发) + if (fromPage) { + scrollToFirstBook(); + } + layui.use('laypage', function () { var laypage = layui.laypage; @@ -500,7 +505,7 @@ //首次不执行 if (!first) { - search(obj.curr, obj.limit); + search(obj.curr, obj.limit, true); } else { } @@ -519,6 +524,12 @@ } + // 滚动到小说列表首行,需扣除吸顶头部高度(44px)避免首条卡片被头部遮挡 + function scrollToFirstBook() { + var top = $("#bookList").offset().top - 50; + $('html,body').animate({scrollTop: top > 0 ? top : 0}, 200); + } + var categoryList; $.ajax({ type: 'get', url: '/book/listBookCategory', data: {}, success: function (data) {