我想在秒表等现有数字中添加数字,我的功能是完美添加数字,但我想添加像秒表这样的动画,我试过但我没有得到任何线索完成它。这里有一个working demo如何在动画中添加数字
$('a').click(function() {
var val = parseInt($(this).text());
var currentVal = parseInt($('#price').text())
var cal = parseInt(val-currentVal)
var club = parseInt($('#price').text()) + cal
var bb = $('#price').text(club)
})
})
HTML
<a href="#">10000</a>
<a href="#">12000</a>
<a href="#">15000</a>
<div id="price">10000</div>
你可以定义像'秒表'的动画吗?我看过的秒表没有动画,数值刚刚出现。 –
像http://stackoverflow.com/questions/4424099/js-jquery-number-increasing-animation和http://stackoverflow.com/questions/5411343/how-to-animate-numbers-using-jquery? –
@RoryMcCrossan:请看这个http://thecodeplayer.com/walkthrough/make-a-stopwatch-using-css3-without-images-or-javascript,你可以看到增加的价值 – jchand