mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-09-07 00:36:41 +08:00
优化消息滚动逻辑
This commit is contained in:
@@ -123,8 +123,8 @@ function scrollMessageToEnd() {
|
|||||||
const { scrollTop, scrollHeight, clientHeight } = cardText
|
const { scrollTop, scrollHeight, clientHeight } = cardText
|
||||||
// 计算距离底部的距离
|
// 计算距离底部的距离
|
||||||
const distanceFromBottom = scrollHeight - scrollTop - clientHeight
|
const distanceFromBottom = scrollHeight - scrollTop - clientHeight
|
||||||
// 如果用户距离底部小于100px,认为用户在底部附近,执行自动滚动
|
// 如果用户距离底部小于1/3屏幕高度,认为用户在底部附近,执行自动滚动
|
||||||
if (distanceFromBottom <= 100) {
|
if (distanceFromBottom <= clientHeight / 3) {
|
||||||
cardText.scrollTop = cardText.scrollHeight
|
cardText.scrollTop = cardText.scrollHeight
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user