gpt4 book ai didi

jquery - .delay() 和 .setTimeout()

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

根据 jQuery 文档中的.delay()

The .delay() method is best for delaying between queued jQuery effects. Because it is limited—it doesn't, for example, offer a way to cancel the delay—.delay() is not a replacement for JavaScript's native setTimeout function, which may be more appropriate for certain use cases.

有人可以详细说明一下吗?什么时候使用.delay()比较合适,什么时候使用.setTimeout()比较好?

最佳答案

我认为您发布的内容确实说明了一切。

使用.delay()来实现包括动画在内的jQuery效果。

setTimeout() 最适合用于其他一切。例如,当您需要在特定的耗时触发事件时。

关于jquery - .delay() 和 .setTimeout(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7407935/

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