I am using the newest flexslider from Woothemes, and I am trying to init one flexslider inside another. Like this:
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
});
}
});
}
but when I call the script, is generates flexsliderFrontpage02 ul below flexsliderFrontpage01 and not inside the slide (list element) - like this:
<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>
Do any of you know if theres an easy fix to flexslider.js or am I doing something wrong ? :-)
my HTML looks like this:
<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>
I have solved it by using this example here:
Flexslider.js update
slider.container = $(slider.containerSelector, slider).first(); //added .first()
selector: ".slides:first > li", //added :first
Maybe this can help someone else :-)
I just change the default selector from ".slides > li"
to ".slides:first > li"
like this:
$(selector).flexslider({
selector: '.slides:first > li',
...
});
It works like a charm, we don't even need to change the core js file. Thanks for the issue dicussion.
来源:https://stackoverflow.com/questions/14770351/woothemes-flexslider-one-unique-flexslider-inside-another-flexslider-is-it-p