问题描述
在github页面上有一些关于destroy方法的讨论,还有一些关于堆栈的问题,但是还没有一个直接的答案或解决方案,我可以在大量搜索后找到.
There are a few discussions on the github page regarding the destroy method, and a couple questions on stack, but there hasn't been a straightforward answer or solution yet, that I was able to find after alot of searching.
flexslider的当前版本 http://www.woothemes.com/flexslider/没有销毁方法.在注释中,它说以前的版本1.8可以,但是使用该方法不起作用.
The current version of flexslider http://www.woothemes.com/flexslider/ does not have a destroy method. In the notes it says that the former version 1.8 does, but using that method does not work.
我需要取消绑定flexslider元素,然后在另一个元素上调用.flexslider(),因为我不希望同时运行多个滑块.
I need to unbind a flexslider element then call .flexslider() on another element as I don't want several sliders running simultaneously.
我该怎么做?注意:删除导航元素,删除类,解开UL并删除".clone" li
的效果还不够!我想将滑块元素完全恢复为原始状态!
How can I do this? Note: removing nav elements, removing classes, unwrapping the UL and removing ".clone" li
's is not good enough! I want to completely return the slider element to its original state!
现在,我在初始化flexslider之前先克隆滑块,然后使用.after()
在克隆之后插入克隆,然后移除滑块.但这对我来说似乎是一种非常笨拙的方法.
Right now I clone the slider before initializing flexslider, then use .after()
to insert the clone after the slider, then remove the slider. But this seems like a very heavy handed approach to me.
$projCur.addClass('flexslider').flexslider({
animation: "slide",
animationSpeed: 500,
slideshow: false,
manualControls: '.dot-nav li a'
});
谢谢!
推荐答案
一个Github用户提交了一个pull请求,为插件添加destroy方法. https://github.com/woothemes/FlexSlider/pull/771
A Github user has submitted a pull request to add a destroy method for the plugin.https://github.com/woothemes/FlexSlider/pull/771
我使用此用户版本的插件和他的destroy方法,它对我来说非常有用.我从 https://github.com/bradgreens/FlexSlider/tree获取/release-2-2-0
I took this users version of the plugin with his destroy method and it works great for me. I got it from https://github.com/bradgreens/FlexSlider/tree/release-2-2-0
这篇关于如何销毁/移除/解除绑定Flexslider的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!