Code Monkey home page Code Monkey logo

Comments (4)

decthomas avatar decthomas commented on May 17, 2024

I had a similar problem with an animation that wouldn't play multiple times even though it had been triggered.
Adding animation-direction: alternate; to the CSS did the trick for me.

from animate.css.

daneden avatar daneden commented on May 17, 2024

@dec adding animation-direction: alternate didn't fix this unfortunately!

from animate.css.

millermedeiros avatar millermedeiros commented on May 17, 2024

it needs to happen on a timeout or you need to stop and remove the animation before setting a new one:

//"poor code" just to test on the console
$('.butt-small:first').click(function(evt){
  //just to block the current `onclick` and the link itself
  evt.preventDefault(); 
  evt.stopPropagation();

  var $at = $('#animateTest').removeClass();  
  //timeout is important !!
  setTimeout(function(){ 
    $at.addClass('flash') 
  }, 10); 
});

I would probably add a data-attribute to each button and create a generic click handler (and remove the "onclick" attributes):

<a href="#cta" class="butt butt-small butt-anim" data-anim="flash">flash</a>
jQuery(document).ready(function($){

    var destAnim = '',
        $animateTest = $('#animateTest');

    function animateOnClick(evt){
        $animateTest.removeClass();
        //need to add a `data-anim="animationName"` to each btn
        destAnim = $(this).data('anim');
        setTimeout(addDestAnimClass, 10);
    }

    function addDestAnimClass(){
        $animateTest.addClass(destAnim);
    }

    //need to add a class '.butt-anim' to each btn that toggles animations
    $('.butt-anim').live('click', animateOnClick);

});

I was going to fork it and do it but then I realized the project page isn't a gh-pages banch..

cheers.

from animate.css.

daneden avatar daneden commented on May 17, 2024

New demo page doesn't have this issue.

from animate.css.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.