我在导航栏动画上使用 gsap,导航栏应该从右侧滑动,而作为深色叠加层的父 div 需要淡出。第一个很好,但是当我为父级添加淡出时,子项(导航栏)也受到影响,如何防止子项上的不透明度变换并仅将其应用于父项。 这里是包含问题的代码
//closing the navbar
//cart-container is the child div
gsap.to('.cart-container', 0.5, { x: 360 }, '+=1') //sliding the nav from to the right
gsap.to('.cart-dark-overlay', 0.5, { opacity: 0 }, '+=1') //changing the opacity for the overlay