我正在使用来自Slick.js
的滑块同步,并且需要仅使用一个导航器来控制另外两个。
<div class="main">
<div>content</div>
<div>content</div>
</div>
<div class="navigator">
<div>nav1</div>
<div>nav2</div>
</div>
<div class="secondary">
<div>content related with main1</div>
<div>content related with main2</div>
</div>
这是我的js代码
var slickMainFrame = {
slidesToShow: 1,
slidesToScroll: 1,
arrows: true,
fade: true,
asNavFor: '.navigator',
};
var slickNav = {
dots: false,
slidesToShow: 2,
slidesToScroll: 1,
arrows: true,
fade: true,
asNavFor: '.main',
speed: 500,
};
$('.main').slick(slickMainFrame);
$('.secondary').slick(slickMainFrame);
$('.navigator').slick(slickNav);
这根本不起作用..我已经尝试使用slickNav的asNavFor属性作为数组或冒号分开,但它不能正常工作。 asNavFor:'。main,.secondary'
答案 0 :(得分:6)
试试这个:
HTML
<div class="main asnavForClass">
<div>content</div>
<div>content</div>
</div>
<div class="navigator">
<div>nav1</div>
<div>nav2</div>
</div>
<div class="secondary asnavForClass">
<div>content related with main1</div>
<div>content related with main2</div>
</div>
的Javascript
var slickMainFrame = {
slidesToShow: 1,
slidesToScroll: 1,
arrows: true,
fade: true,
};
var slickNav = {
dots: false,
slidesToShow: 2,
slidesToScroll: 1,
arrows: true,
fade: true,
asNavFor: '.asnavForClass',
speed: 500,
};
$('.main').slick(slickMainFrame);
$('.secondary').slick(slickMainFrame);
$('.navigator').slick(slickNav);