注释一些滚动动画相关控制台信息
This commit is contained in:
parent
e474ef2936
commit
5943f768e1
@ -229,8 +229,8 @@ const initScroll = () => {
|
||||
// 强制重新计算布局
|
||||
void content.offsetHeight;
|
||||
|
||||
console.log("内容高度:", content.scrollHeight);
|
||||
console.log("容器高度:", container.clientHeight);
|
||||
// console.log("内容高度:", content.scrollHeight);
|
||||
// console.log("容器高度:", container.clientHeight);
|
||||
|
||||
// 重置位置和动画
|
||||
content.style.transition = "none";
|
||||
@ -239,24 +239,24 @@ const initScroll = () => {
|
||||
// 如果内容高度大于容器高度,需要滚动
|
||||
if (content.scrollHeight > container.clientHeight) {
|
||||
const scrollDistance = content.scrollHeight - container.clientHeight;
|
||||
console.log("滚动距离:", scrollDistance);
|
||||
// console.log("滚动距离:", scrollDistance);
|
||||
|
||||
// 设置滚动动画
|
||||
const scroll = () => {
|
||||
console.log("开始滚动");
|
||||
// console.log("开始滚动");
|
||||
const animationDuration = scrollDistance / 20; // 2.8秒
|
||||
content.style.transition = `transform ${animationDuration}s linear`;
|
||||
content.style.transform = `translateY(-${scrollDistance}px)`;
|
||||
|
||||
// 动画结束后回到起点并暂停2秒
|
||||
scrollTimer1 = setTimeout(() => {
|
||||
console.log("滚动完成,回到起点");
|
||||
// console.log("滚动完成,回到起点");
|
||||
content.style.transition = "none";
|
||||
content.style.transform = "translateY(0)";
|
||||
|
||||
// 2秒后重新开始滚动
|
||||
scrollTimer2 = setTimeout(() => {
|
||||
console.log("暂停结束,重新开始滚动");
|
||||
// console.log("暂停结束,重新开始滚动");
|
||||
scroll();
|
||||
}, 2000);
|
||||
}, animationDuration * 1000);
|
||||
@ -264,7 +264,7 @@ const initScroll = () => {
|
||||
|
||||
// 初始暂停2秒后开始滚动
|
||||
scrollTimer1 = setTimeout(() => {
|
||||
console.log("初始暂停结束,开始滚动");
|
||||
// console.log("初始暂停结束,开始滚动");
|
||||
scroll();
|
||||
}, 2000);
|
||||
} else {
|
||||
@ -285,7 +285,7 @@ onMounted(() => {
|
||||
watchEffect(() => {
|
||||
// 强制依赖 stations 数组的长度
|
||||
const stationsLength = forcePreset.value.stations?.length || 0;
|
||||
console.log("stations长度变化:", stationsLength);
|
||||
// console.log("stations长度变化:", stationsLength);
|
||||
|
||||
nextTick(() => {
|
||||
setTimeout(() => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user