Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8559651
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T16:06:10+00:00 2026-06-11T16:06:10+00:00

I have an animation using Animate.CSS that I would like to have replay if

  • 0

I have an animation using Animate.CSS that I would like to have replay if the user would like but what I have attempted does not work. Here is the code:

HTML:

    <div class="img-center">
       <img src="path.jpg" class="feature-image animated rotateInDownRight" />
    </div>
       <p class="textcenter">&nbsp;</p>
    <div class="img-center">
       <a href="#" id="replay">Replay</a>
    </div>

JS:

var $j = jQuery.noConflict();
$j("#replay").click(function() {
    $j('.feature-image').removeClass('animated rotateInDownRight').addClass('animated rotateInDownRight');
});

I do know the script itself works as I can see it happen in Firebug however that animation doesn’t animate again. How do I achieve this with Animate.CSS?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T16:06:11+00:00Added an answer on June 11, 2026 at 4:06 pm

    This is just a guess but it appears that jQuery isn’t “finished” removing the class before it adds it back in. I know this makes NO sense, but it’s how JavaScript works. It can call the next function in the chain before all the stuff from the first one is finished. I poked around the code on Animate.CSS’s site and saw that they use a timeout in their animation function. You might try the same. Here’s their code:

    function testAnim(x) {
        $('#animateTest').removeClass().addClass(x);
        var wait = window.setTimeout( function(){
            $('#animateTest').removeClass()},
            1300
        );
    }
    

    What this is doing is exactly like what you are doing except that it waits for the animation to finish, then removes the classes. That way when the other class is added back in, it is truely “new” to the tag. Here is a slightly modified function:

    function testAnim(elementId, animClasses) {
        $(elementId).addClass(animClasses);
        var wait = window.setTimeout( function(){
            $(elementId).removeClass(animClasses)},
            1300
        );
    }
    

    Notice two things: First this code would allow you to change what element gets the animation. Second, you remove the classes you added after 1300 milliseconds. Still not 100% there, but it might get you further down the road.

    It should be noted that if there is already some animation classes on the object it might break this JS.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have added some animation using jquery but it's not working: $('.test-container').click(function(){ $(this).css('background-color', 'rgb(119,
I have a few panels that I slide horizontally using the animate function that
I am using animate.css and right now I have a CSS style for animated2500
I have some browser-intensive CSS and animation in my webpage and I'd like to
I have one image animation started using GameQuery. Now I want to stop the
I have Divs show and hide (with an animation) using the following script (I
I have the following animation set up using Three.js: http://frontier.lincoln.ac.uk/3d/development/Stage2/characters/man2.html Please ignore the ropey
I have recently created a HTML5 canvas animation (also using Processing.js). The problem is
I have a problem with an animation in jQuery using ajax. On the click
I am using libgdx on a little game and I have a little animation

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.