问题描述
我正在使用由以下代码触发的flexslider插件:
I am using the flexslider plugin which is triggered by the following code:
$(window).on('load', function () {
$('.flexslider').flexslider();
});
此操作在页面加载后运行.在应用程序的后面,我替换了flexslider的内容(其中的图像数量及其来源),并且需要重新加载flexslider.
This runs once the page has loaded. Later in the application I've replaced the contents of the flexslider (the number of images in it and their sources) and need to re-load the flexslider.
我的代码如下:
document.getElementById('contestant1').onclick = function() {
process();
}
output = "";
for (num=1; num<=3; num++) {
imagesource = "Week" + num + "/Antony.png";
output = output + "<li> <img src=" + imagesource + " /> </li>";
}
document.getElementById('images').innerHTML = output;
console.log(output);
$('.flexslider').flexslider();
请告诉我如何强制flexslider重新加载.这是完整应用程序的链接,但是它具有与问题无关的一些更复杂的元素:
Please tell me how to force the flexslider to re-load. Here is a link to the full application, however it has a few more complex elements not relevant to the problem:
http://eg-graphics.com/zwooper/EGVGV/Season2 /MemoryWall.html
推荐答案
找出解决方法:
添加了以下行:$('#flexslider').removeData("flexslider");
在此之前:$('.flexslider').flexslider();
像梦一样奔跑
这篇关于重新加载Flexslider的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!