jquery detach animate() 函数(不分离或终止事件监听器)

发布于 12-05 08:10 字数 425 浏览 4 评论 0原文

你好,我正在使用一个名为“pulse”的 jQuery 插件(http://james.padolsey.com/javascript/simple-pulse-plugin-for-jquery/),它的工作原理与广告中的一样。它本质上是 animate 的一个简短包装,具有脉冲效果。

然而,我需要做的是让一个 div 永远脉冲直到某个事件,然后代码需要停止这个脉冲,另一个 div 将开始永远脉冲。然后它们会交替发出脉冲。

简而言之,我需要在函数完成 animate 之前将 animate 函数与特定的 div 分离。

我研究了 detach() 和 die() 但它们只分离特定的事件侦听器。 (即使使用命名空间,情况似乎也是如此)。我还研究了 jQuery.fx.off,但它会暂停所有动画,当重新打开时,所有动画都会恢复。

请告诉我是否有任何解决方案。谢谢!

Hi I'm using a jQuery plugin called pulse (http://james.padolsey.com/javascript/simple-pulse-plugin-for-jquery/), which is working as advertised. It's essentially a short wrapper on animate to have a pulsing effect.

However, what I need to do is to let one div pulse forever until some event, then the code needs to stop this pulse and another div will start pulsing forever. Then they would alternate pulsing.

In short, I need to detach the animate function from a particular div before the function finishes with animate.

I looked into detach() and die() but they only detach specific event listeners. (even with namespace usage, it seems to be the case). I also looked into jQuery.fx.off, but it pauses all animations and when turned back on, all animations resume.

Please let me know if there is any solution to this. Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

吹泡泡o2024-12-12 08:10:40

尝试 .stop()

Try .stop().

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文