gpt4 book ai didi

javascript - jquery "animate"变量值

转载 作者:可可西里 更新时间:2023-11-01 01:45:15 25 4
gpt4 key购买 nike

我需要用 jquery 来“动画化”一个变量。

示例:变量值为 1。5 秒后该值应为 10。它应该“平稳”地增加。

希望你明白我的意思。

谢谢!

最佳答案

尝试:

$({someValue: 0}).animate({someValue: 10}, {
duration: 5000,
step: function() {
$('#el').text(Math.ceil(this.someValue));
}
});

<div id="el"></div>

关于javascript - jquery "animate"变量值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12317523/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com