gpt4 book ai didi

jQuery 使用 stop() 和 hide()/show()?

转载 作者:行者123 更新时间:2023-12-03 22:31:55 28 4
gpt4 key购买 nike

我想知道是否可以将 stop() 函数(我通常在 animate() 上使用)与 hide() 一起使用或show()

如果我快速将鼠标悬停在使用 show() 显示某些子 div 的 div 上,则显示动画会一遍又一遍地重复。 stop() 函数将停止该行为。

但是我不知道如何将 stop() 函数与 hide()show() 一起使用。

这可能吗?

谢谢
问候马特

最佳答案

您必须设置显示/隐藏效果的持续时间:

.hide('slow')

之后您就可以使用 .stop().stop(true,true)

stop( [ clearQueue ], [ jumpToEnd ] )

clearQueue A Boolean indicating whether to remove queued animation as well. Defaults to false.

jumpToEnd A Boolean indicating whether to complete the current animation immediately. Defaults to false.

另一种方法是添加延迟,例如

 .delay(500).hide(1);

http://api.jquery.com/delay/

.delay( duration, [ queueName ] ) duration An integer indicating the number of milliseconds to delay execution of the next item in the queue.

queueName A string containing the name of the queue. Defaults to fx, the standard effects queue.

关于jQuery 使用 stop() 和 hide()/show()?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3155843/

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