Run two jQuery functions at the same time

后端 未结 4 1852
难免孤独
难免孤独 2021-01-19 12:14

I am using jQuery to slide something down and fade something else out, but in testing it, I\'ve noticed that the fading appears too long after the sliding happens. In other

4条回答
  •  感情败类
    2021-01-19 13:02

       $(document).ready(function(){
    
           $('#trigger').click( function(){
    
               $.Deferred(function(dfr) {
    
                  dfr.pipe(function() {
                      return  $(this).animate({ opacity: 0.0 }); // fade
                  }).
                  pipe(function() {
                      return $('#carousel').animate({ top: '100px' }); // slide
                  })
                  pipe(function() {
                      return $('#pullrefresh').css('top', '-490px'); // line 5
                  }).
                  pipe(function() {
                      return $('#detector').hide(); // line 6
                  });
    
              }).resolve();
    
           });
      });
    

提交回复
热议问题