LuT*_*uTz 5 javascript jquery slider flickity
所以,我正在使用这个https://codepen.io/desandro/pen/wByaqj
我prevNextButtons: true,像这样激活了:
$('.characters-main').flickity({
prevNextButtons: false,
wrapAround: false,
pageDots: false,
autoPlay: 10000
});
$('.characters-nav').flickity({
asNavFor: '.characters-main',
cellAlign: 'right',
prevNextButtons: true,
contain: true,
pageDots: false,
arrowShape: {
x0: 10,
x1: 70, y1: 50,
x2: 70, y2: 50,
x3: 35
}
});
Run Code Online (Sandbox Code Playgroud)
我想要的是,当我单击prevNextButtonsfor .characters-nav时自动从中选择元素.characters-main。
现在是这样的:
// Main div
var flkty = new Flickity('.carousel-main');
// Next and previous events of the navigation div
$(".carousel-nav .next").on("click", function() {
// Changing items of the main div
flkty.next();
});
$(".carousel-nav .previous").on("click", function() {
// Changing items of the main div
flkty.previous();
});
Run Code Online (Sandbox Code Playgroud)
以您的情况为例:
// Your main div is characters-main
var flkty = new Flickity('.characters-main');
// Next and previous events of the characters-nav
$(".characters-nav .next").on("click", function() {
// Changing items of the main div
flkty.next();
});
$(".characters-nav .previous").on("click", function() {
// Changing items of the main div
flkty.previous();
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
874 次 |
| 最近记录: |