我尝试使用以下代码:
$('#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/