我正在使用 Woothemes 的最新 flexslider,我正在尝试在另一个内部初始化一个 flexslider。像这样:
function initFrontpageSliders() {
$('#flexsliderFrontpage01').flexslider({
animation: "slide",
animationLoop: false,
pauseOnHover: true,
start: function(slider) {
//Fires when the slider loads the first slide
$('#flexsliderFrontpage02').flexslider({
animation: "fade",
directionNav: false,
animationLoop: false,
pauseOnHover: true
});
}
});
}
但是当我调用脚本时,会在 flexsliderFrontpage01 下方生成 flexsliderFrontpage02 ul 而不是在幻灯片(列表元素)内 - 像这样:
<div id="flexsliderFrontpage01" class="flexslider">
<div class="flex-viewport">
<ul class="slides">
<li>
<div class="row">
<div id="flexsliderFrontpage02" class="flexslider"> SLIDES SHOULD BE HERE </div>
</div>
</li>
<li>
<div class="row">slide 2</div>
</li>
</ul>
<ul class="slides">
<li><div class="row">fade 1</div></li>
<li><div class="row">fade 2</div></li>
<li><div class="row">fade 3</div></li>
</ul>
</div>
<ol class="flex-control-nav flex-control-paging">
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
<li>5</li>
</ol>
<ul class="flex-direction-nav"> </ul>
</div>
你们有谁知道 flexslider.js 是否有一个简单的修复方法,或者我做错了什么?:-)
我的 HTML 看起来像这样:
<div class="flexslider" id="flexsliderFrontpage01">
<ul class="slides">
<li>
<div class="row">
<div class="flexslider" id="flexsliderFrontpage02">
<ul class="slides">
<li><div class="row">fade div 1</div></li>
<li><div class="row">fade div 2</div></li>
<li><div class="row">fade div 3</div></li>
</ul>
</div>
</div>
</li>
<li>
<div class="row">
<h1>This is slide 2</h1>
</div>
</li>
</ul>
</div>
我在这里使用这个例子解决了这个问题:
Flexslider.js update
slider.container = $(slider.containerSelector, slider).first(); //added .first()
selector: ".slides:first > li", //added :first
也许这可以帮助别人:-)