animate.css不会连续触发两次

时间:2020-04-22 13:45:56

标签: javascript html css animate.css

我有一张桌子,我可以根据需要放置的内容从左侧或右侧淡入。它的创建方式如下:

<table id="table" class="centered animated"></table>

每当我用数据填充数据时,我都会使用DOM对其进行动画处理(使用animate.css):

// This code is executed when the entire table's contents is changed
table.classList.remove('fadeInLeft');
table.classList.remove('fadeInRight');

if (animateFromLeftCondition) { table.classList.add('fadeInRight') }
else if (animateFromRightCondition) { table.classList.add('fadeInLeft') }

动画会正确触发,除非我两次触发相同的动画(例如,我从左侧进行了两次动画)。查看我的devtools时,可以看到该表的类正在更改,这意味着fadeInRightanimated类的删除和添加成功。我是否缺少某些东西使我无法连续执行同一动画两次?

0 个答案:

没有答案