2016-10-14 3 views
1
$(this).prop('Counter', 0).animate({ 
          Counter: 123456789 
         }, { 
          duration: 2000, 
          easing: 'easeOutBack', 
          step: function (now) { 
            $(this).html(parseFloat(now).toFixed(2)); 
          }, 
          complete: function() { 
          } 
}); 

このコード番号は同じ速度で終了するまで終了します。私は目標に達すると、実行速度が遅くなる番号が必要です。目標到達時のJquery数カウントダウンアニメーション

答えて

0

スピードのための変数を作成し、これをstepでincraseすることができます。あなたの例では:

var speed = 2000; 
$(this).prop('Counter', 0).animate({ 
     Counter: 123456789 
    }, { 
     duration: speed, 
     easing: 'easeOutBack', 
     step: function (now) { 
      $(this).html(parseFloat(now).toFixed(2)); 
      if(counter < 1000){ 
       speed += 100; 
      } 
     }, 
     complete: function() { 
     } 
    }); 
関連する問題