【发布时间】:2019-09-02 16:00:28
【问题描述】:
我想在 rgba 中为模态的背景颜色设置动画,使其淡入。我不能将不透明度用作模态内的 div,我不想透明。我不能使用 Jquery,但我正在使用 React。
我没有得到以下错误提示不起作用
const modal = document.getElementById('modal');
modal.animate(
[
{backgroundColor: 'rgba(255, 0, 0, 0)'},
{backgroundColor: 'rgba(255, 0, 0, 0.8)'}
],
{duration: 200, easing: 'ease-in-out', fill: 'forwards'}
);
【问题讨论】:
-
这段代码对我有用。可以分享MCVE吗?
-
在探索了下面的解决方案后,我发现它确实有效,我只是看不到它,因为我将不透明度设置为 0
标签: javascript css web-animations