瀏覽代碼

feat: 帐号列表单位自动滚动到激活的项

lanjianrong 3 周之前
父節點
當前提交
1d41b3f829
共有 1 個文件被更改,包括 9 次插入0 次删除
  1. 9 0
      app/public/js/setting.js

+ 9 - 0
app/public/js/setting.js

@@ -274,6 +274,15 @@ $(document).ready(() => {
             $('#nav_tender').attr('href', item.path)
         });
     });
+
+    const $activeItem = $('.list-group-item.active');
+    if ($activeItem.length) {
+      const $scrollContainer = $activeItem.closest('.col-3');
+      const scrollTop = $activeItem.offset().top - $scrollContainer.offset().top + $scrollContainer.scrollTop();
+      $scrollContainer.animate({ scrollTop: scrollTop }, 100);
+    }
+
+
     // 设置页显示数目
     $('.nav-tabs .nav-link').each(function () {
         const pageSize = getLocalCache('account-pageSize') ? getLocalCache('account-pageSize') : '';