X 归档 2022-08-15
JavaScript && CSS Tip! ✨
Use IntersectionObserver(IO) with a low threshold and custom properties to power list animations 🔥
http://el.style.setProperty('--shown', entry.isIntersecting ? 1 : 0)
li { scale: calc(0.25 + (var(--shown, 1) * 0.75));}
Demo link below! 👇
Use IntersectionObserver(IO) with a low threshold and custom properties to power list animations 🔥
http://el.style.setProperty('--shown', entry.isIntersecting ? 1 : 0)
li { scale: calc(0.25 + (var(--shown, 1) * 0.75));}
Demo link below! 👇
JavaScript && CSS 小技巧!✨
用低阈值的 IntersectionObserver(IO) 搭配自定义属性来驱动列表动画 🔥
http://el.style.setProperty('--shown', entry.isIntersecting ? 1 : 0)
li { scale: calc(0.25 + (var(--shown, 1) * 0.75));}
演示链接在下面!👇
用低阈值的 IntersectionObserver(IO) 搭配自定义属性来驱动列表动画 🔥
http://el.style.setProperty('--shown', entry.isIntersecting ? 1 : 0)
li { scale: calc(0.25 + (var(--shown, 1) * 0.75));}
演示链接在下面!👇
