我想在滚动页面时在 css 上使用 scale3d 逐渐增加比例。喜欢从
scale3d(1, 1, 1) to scale3d(2, 2, 2)
const container = document.querySelector('.container-testi');
const containerHeight = container.scrollHeight;
const iWillExpand = document.querySelector('.iWillExpand');
container.onscroll = function(e) {
iWillExpand.style.transform = `scale3d(${0.8 + 0.2 * container.scrollTop / (containerHeight -
300)})`;
};
.iWillExpand{
transform: translate3d(0px, 0px, 0px) scale3d(1, 1, 1)
rotateX( 0deg) rotateY(0deg) rotateZ(0deg) skew(0deg, 0deg);
transform-style: preserve-3d;
}
我的代码没有按照我想要的方式工作,有什么办法可以做到吗?谢谢你