谷歌运行丝滑,火狐 得到数据不匹配,狐狐是不是没人打理了, 想哭
这不是一模一样的嘛,谁让你火狐点了个翻译?醉了
你这个 自动翻译了吧
应该是不会出现这个问题的,你看看分页总数是不是由于翻译导致的,浏览器差异基本体现在样式,兼容等模块,数据获取不到可以检查一下控制台报错这些
//图像/歌词滑动切换的效果
middleTouchStart(e) {
this.touch.initiated = true; //初始化
const touch = e.touches[0];
this.touch.startX = touch.pageX;
this.touch.startY = touch.pageY;
},
middleTouchMove(e) {
if (!this.touch.initiated) {
return;
}
const touch = e.touches[0];
const deltaX = touch.pageX - this.touch.startX;
const deltaY = touch.pageY - this.touch.startY;
if (Math.abs(deltaY) > Math.abs(deltaX)) {
//纵轴上的偏移大于横轴上的位移,认为是纵向滚动,不切换
return;
}
const left = this.currentShow === "img" ? 0 : -window.innerWidth; //为图像则不偏移,为歌词则向左移。
const offsetWidth = Math.min(
0,
Math.max(-window.innerWidth, left + deltaX)
);
this.touch.percent = Math.abs(offsetWidth / window.innerWidth); //得到滑动的比例
this.$refs.lyricList.$el.style.transform = `translate3d(${offsetWidth}px,0,0)`; //vue组件无法直接访问节点,使用$el
this.$refs.lyricList.$el.style.transform = `transformDuration:300ms`;
this.$refs.middleL.style.opacity = 1 - this.touch.percent;
this.$refs.middleL.style.transform = `transformDuration:300ms`;
},
middleTouchEnd() {
let offsetWidth;
let opacity; //从右向左滑
if (this.currentShow == "img") {
//滑动距离大于10%
if (this.touch.percent > 0.1) {
offsetWidth = -window.innerWidth;
opacity= 0;
this.$refs.middleL.style.opacity = opacity;
this.$refs.middleL.style.transform = `transformDuration:300ms`;
this.currentShow = "lyric"; //同时改变当前显示状态
} else {
offsetWidth = 0;
opacity= 1;
this.$refs.middleL.style.opacity = opacity;
this.$refs.middleL.style.transform = `transformDuration:300ms`;
}
}
//从左向右滑
else {
if (this.percent < 0.9) {
offsetWidth = 0;
opacity= 1;
this.$refs.middleL.style.opacity = opacity;
this.$refs.middleL.style.transform = `transformDuration:300ms`;
this.currentShow = "img";
} else {
offsetWidth = -window.innerWidth;
opacity= 0;
this.$refs.middleL.style.opacity = opacity;
this.$refs.middleL.style.transform = `transformDuration:300ms`;
}
}
this.$refs.lyricList.$el.style.transform = `translate3d(${offsetWidth}px,0,0)`; //vue组件无法直接访问节点,使用$el
this.touch.initiated = false
}
样式
.middle {
width: 202vw;
.middle-l {
width: 100vw;
vertical-align: top;
display: inline-block;
transition: all 1s;
.cd-wrapper {
.cd {
.image {
width: 17rem;
border: 2px solid gray;
border-radius: 50%;
animation: imgRotate 20s linear infinite;
}
}
}
}
.middle-r {
width: 100vw;
display: inline-block;
transition: all 1s;
.lyric-wrapper {
.text {
line-height: 2;
color: rgba(255, 255, 255, 0.5);
font-size: 1rem;
}
// 当前行歌词高亮
.currentLine {
font-size: 1.2rem;
color: rgba(255, 255, 255, 1);
}
}
}
.wrapper {
height: 63vh !important;
}
}
此时图像和歌词能够左右切换。