将 类 添加到伪元素

Adding classes to pseudo-elements

所以我使用伪元素来使用自定义复选标记 SVG,如下所示:

.thing:before {
    content: " ";
    background: $tickMarkURL;
    background-size: 1.5em;
    background-size: contain;
    width: 1.2em;
    height: 1.2em;
    display: inline-block;
}

(注意:这实际上使用了 SCSS,所以这就是 $variables 的原因。)

我想使用 Animate.css 将此复选标记设置为动画。但是,Animate.css 使用 类 为元素添加动画。我不认为这个伪元素是可能的(我认为)。还有其他方法吗?

您可以在 animate.css 文件中搜索 animation 并将其添加到 :before scss

.thing:before {
  -webkit-animation-name: bounce;
  animation-name: bounce;
  -webkit-transform-origin: center bottom;
  transform-origin: center bottom;
}