jQuery - 删除附加到div的函数 [英] jQuery - remove function attached to div

查看:68
本文介绍了jQuery - 删除附加到div的函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在遇到jQuery问题,所以我想我已经找到了解决方法,但需要帮助。

I'm running into a problem with jQuery, so I think I've figured out a workaround, but need help.

我目前在我的div上附上一个cycle()幻灯片:

I currently attach a cycle() slideshow to my div like this:

function startSlideshow() {
    $('#slideshow').cycle({ some parameters });
}

当我暂停并重新启动此幻灯片时,由于错误,它表现出奇怪的行为在循环插件中。所以我的解决方法是这样的:破坏现有的循环()然后只是动态地重新创建它。

When I pause and restart this slideshow, it exhibits weird behavior, due to bugs in the cycle plugin. So my workaround idea is this: to destroy the existing cycle() and then just recreate it on the fly.

我可以通过再次调用startSlideshow()轻松地重新创建它。 ..但是如何杀死附加到div的旧循环()?

I can easily recreate it by calling startSlideshow() again... but how do I kill the old cycle() that's attached to the div?

我想我正在寻找一种取消设置或解除绑定的方法它完全(和jQuery的unbind()方法不是)。

I guess I'm looking for a way to "unset" or "unbind" it completely (and jQuery's unbind() method isn't it).

谢谢 -
Eric

Thanks-- Eric

推荐答案

你可以使用 $('#slideshow')。cycle('destroy');

但是你确定奇怪的行为是由于循环插件有错误吗?而不是不当使用它?

But are you sure the weird behaviour is due to the cycle plug-in having bugs ? and not improper usage of it ?

你如何暂停和重新开始骑行?

How do you pause and restart the cycling ?

这篇关于jQuery - 删除附加到div的函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆