diff --git a/public/site/css/log.css b/public/site/css/log.css index 46b0b9b91..b074d42b8 100644 --- a/public/site/css/log.css +++ b/public/site/css/log.css @@ -135,6 +135,11 @@ .logs-sticky{ position: sticky; top: 80px; + height: calc(100vh - 136px); +} +#help-l-ul{ + overflow-y: auto; + height: calc(100% - 36px); } .footer-layut{ border-top: var(--border-color) solid 1px; diff --git a/public/site/en/help.html b/public/site/en/help.html index e778a924f..649d98287 100644 --- a/public/site/en/help.html +++ b/public/site/en/help.html @@ -2440,6 +2440,18 @@ "[data-id='" + `section-${i}` + "']" ); elementsWithDataId[0]?.classList?.add("active"); + //滚动设置 + const liHight = elementsWithDataId[0]?.offsetTop; + const pHihtt = elementsWithDataId[0]?.parentNode.parentNode.offsetHeight; + const ulElement = document.getElementById('help-l-ul'); // 替换为你的
元素的 id + const scrollHeight = ulElement.scrollTop; + const ulHeight = ulElement.offsetHeight; + if (liHight > scrollHeight + ulHeight) { + ulElement.scrollTop += (pHihtt + 24); + } + if (liHight < scrollHeight) { + ulElement.scrollTop -= (pHihtt + 24); + } return; } } diff --git a/public/site/en/log.html b/public/site/en/log.html index 6f0e8bf7e..cdf1df3bd 100644 --- a/public/site/en/log.html +++ b/public/site/en/log.html @@ -511,6 +511,18 @@ function scrollHandler(){ rm() let elementsWithDataId = document.querySelectorAll("[data-id='" + `section-${i}` + "']"); elementsWithDataId[1]?.classList?.add("active"); + //滚动设置 + const liHight = elementsWithDataId[1]?.offsetTop; + const pHihtt = elementsWithDataId[1]?.offsetHeight; + const ulElement = document.getElementById('help-l-ul'); // 替换为你的
元素的 id + const scrollHeight = ulElement.scrollTop; + const ulHeight = ulElement.offsetHeight; + if (liHight > scrollHeight + ulHeight) { + ulElement.scrollTop += (pHihtt + pHihtt); + } + if (liHight < scrollHeight) { + ulElement.scrollTop -= (pHihtt + pHihtt); + } return; } } diff --git a/public/site/zh/help.html b/public/site/zh/help.html index 10d7b2e1c..dfa268eb4 100644 --- a/public/site/zh/help.html +++ b/public/site/zh/help.html @@ -816,6 +816,18 @@ function scrollHandler(){ if (arrOffsetTop[i] > window.scrollY){ let elementsWithDataId = document.querySelectorAll("[data-id='" + `section-${i}` + "']"); elementsWithDataId[0]?.classList?.add("active"); + //滚动设置 + const liHight = elementsWithDataId[0]?.offsetTop; + const pHihtt = elementsWithDataId[0]?.parentNode.parentNode.offsetHeight; + const ulElement = document.getElementById('help-l-ul'); // 替换为你的
元素的 id + const scrollHeight = ulElement.scrollTop; + const ulHeight = ulElement.offsetHeight; + if (liHight > scrollHeight + ulHeight) { + ulElement.scrollTop += (pHihtt + 24); + } + if (liHight < scrollHeight) { + ulElement.scrollTop -= (pHihtt + 24); + } return; } } diff --git a/public/site/zh/log.html b/public/site/zh/log.html index 405e0bed8..31ec06d3b 100644 --- a/public/site/zh/log.html +++ b/public/site/zh/log.html @@ -509,6 +509,18 @@ function scrollHandler(){ rm() let elementsWithDataId = document.querySelectorAll("[data-id='" + `section-${i}` + "']"); elementsWithDataId[1]?.classList?.add("active"); + //滚动设置 + const liHight = elementsWithDataId[1]?.offsetTop; + const pHihtt = elementsWithDataId[1]?.offsetHeight; + const ulElement = document.getElementById('help-l-ul'); // 替换为你的
元素的 id + const scrollHeight = ulElement.scrollTop; + const ulHeight = ulElement.offsetHeight; + if (liHight > scrollHeight + ulHeight) { + ulElement.scrollTop += (pHihtt + pHihtt); + } + if (liHight < scrollHeight) { + ulElement.scrollTop -= (pHihtt + pHihtt); + } return; } }