我有一张桌子,我可以根据需要放置的内容从左侧或右侧淡入。它的创建方式如下:
<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时,可以看到该表的类正在更改,这意味着fadeInRight
和animated
类的删除和添加成功。我是否缺少某些东西使我无法连续执行同一动画两次?