1.缩放图片;
1 // 背景图片的缩放 2 let scale = 1 3 const percent = Math.abs(newY/this.imageHeight)//这么计算,图片的高度相当于增加了newY; 4 if(newY > 0){//向下拉的时候 5 scale = 1 + percent 6 } 7 this.$refs.bgImage.style[‘transform‘] = `scale(${scale})` 8 this.$refs.bgImage.style[‘webkittransform‘] = `scale(${scale})` 9 }
注意:将北京图片的transfomr-origin:top;
原文地址:https://www.cnblogs.com/yangguoe/p/9462610.html
时间: 2024-11-20 07:43:49