Looping with .each with delay in Jquery

后端 未结 5 1039
时光说笑
时光说笑 2021-01-16 14:20

I am not good at jQuery so I am not sure if my assumptions are corrent.

I am using the isotope plugin, with which I want to insert elements one by one (and not every

5条回答
  •  逝去的感伤
    2021-01-16 15:02

    little late but my workaround was: hardcode a class to item like to_animate

    the css:

    .item.to_animate { opacity:0; display:block; } @keyframes TransitionClass{ 0% { opacity: 0;transform: scale(1.2); } 100% { opacity: 1;transform: scale(1); } } .animatefinish.TransitionClass{ animation-name: umScaleIn; animation-timing-function: cubic-bezier(0.19,1,.22,1); } .animatefinish.TransitionClass{ animation-duration: .8s; }

    the snipped for isotope

        `$('#container').isotope( 'appended', $(el) ).after(function() {
    
          $('.item.to_animate').each(function(i) {
          var el = $(this);
    
                  setTimeout(function() {
    
                  el.addClass('TransitionClass animatefinish');
    
                      el.removeClass('to_animate')
    
                  }, i * 200);
    
          });
    
        });`
    

提交回复
热议问题