gpt4 book ai didi

jquery - 如何使用 jquery animate 配置滚动速度?

转载 作者:行者123 更新时间:2023-12-03 22:58:47 25 4
gpt4 key购买 nike

我尝试使用以下代码:

$('#divid').html(html).animate ({scrollTop:0}, "fast"); // Are slow, medium, fast parameters.

我也厌倦了使用这段代码:

$('#divid').html(html).animate ({scrollTop:0}, "500");

我的最终目标是让用户能够配置滚动速度并将该参数传递给动画函数。但是,这两种方法似乎对滚动速度没有影响。我做错了什么?

最佳答案

animate 函数期望持续时间为字符串或数字。只需将其作为数字传递即可。

$('#divid').html(html).animate ({scrollTop:0}, 500);

关于jquery - 如何使用 jquery animate 配置滚动速度?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14260539/

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