问题描述
如何从flexslider中删除所有幻灯片并添加新幻灯片?
How do I remove all slides from flexslider and add new slides?
还是我应该销毁并重新设置flexslider?
Or how to do I destroy and reintialise flexslider?
基本上我想以任何一种方式重置flexslider.
Basically I want to reset flexslider either way.
//Create hotel image array
$('#carousel').flexslider({
animation: "slide",
controlNav: false,
animationLoop: false,
slideshow: false,
itemWidth: 210,
itemMargin: 0,
minItems: 4,
asNavFor: '#slider'
});
$('#slider').flexslider({
animation: "slide",
controlNav: false,
animationLoop: false,
slideshow: false,
sync: "#carousel",
start: function (slider) {
$('body').removeClass('loading');
}
});
链接到flexslider:
Links to flexslider:
- http://www.woothemes.com/flexslider/
- https://github.com/woothemes/flexslider
PLUNKR LINK: LINK
PLUNKR LINK: LINK
我下载了此版本,该版本应该具有destroy方法: https://github.com/woothemes/FlexSlider/pull/716
I downloaded this version which is supposed to have a destroy method:https://github.com/woothemes/FlexSlider/pull/716
我以为这是答案,但是由于某种原因,轮播似乎在第二次加载后似乎不再工作了,好像我没有再次对其进行初始化一样?
I thought this would be the answer but for some reason my carousel seems to no longer work after loading in a second set as if I didn't reinitialize it again?
推荐答案
好的,所以在深入研究之后发现flexslider现在有一个destroy方法,但是它要求我使用github页面上的演示才能使其正常工作.我创建了一个工作的插销,该插销添加并删除了flexslider轮播 LINK
Ok so after digging around it turns out that flexslider now has a destroy method but it required me to use the demo on the github page to get it working. I created a working plunker which adds and removes a flexslider carousel LINK
也请参见此处: LINK
这篇关于清除并添加幻灯片/重新初始化flexslider?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!