bendc / animateplus

A+ animation module for the modern web

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Clear styles when animation is finnished.

tomtev opened this issue · comments

Hi, I can see that on the Stripe site the animation styles get removed from the style tag when the animation is finished. Is there an option for this?

You can use the complete callback to clear the inline styles at the end of the animation:

animate({
  el: "div",
  translateX: 200,
  complete: arr => arr.forEach(el => el.removeAttribute("style"))
});

That being said, removing the styles will obviously cancel the transformation applied (so, in this example, the divs will come back to translateX 0).