Skip to content

Commit

Permalink
Fix scrollbar out of bounds issue
Browse files Browse the repository at this point in the history
  • Loading branch information
hbl917070 committed Dec 2, 2024
1 parent 0a173c9 commit 1235288
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Www/ts/TiefseeScroll.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,16 @@ export class TiefseeScroll {
domPanel.addEventListener("scroll", () => {
let val;
if (_type === "y") {
// 避免滾動條超出範圍
if (domPanel.scrollTop > domContent.clientHeight - domPanel.clientHeight) {
domPanel.scrollTop = domContent.clientHeight - domPanel.clientHeight;
}
val = domPanel.scrollTop;
_domScroll.style.top = val + "px"; // 坐標定位
} else {
if (domPanel.scrollLeft > domContent.clientWidth - domPanel.clientWidth) {
domPanel.scrollLeft = domContent.clientWidth - domPanel.clientWidth;
}
val = domPanel.scrollLeft;
_domScroll.style.left = val + "px"; // 坐標定位
}
Expand Down

0 comments on commit 1235288

Please sign in to comment.