slickjs 总是显示箭头 [英] slickjs always show arrows

查看:20
本文介绍了slickjs 总是显示箭头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试配置 slick.js 以在任何情况下显示箭头.

I'm trying to config slick.js to show arrows in any circumstance.

$('.slider-for').slick({
  slidesToShow: 1,
  slidesToScroll: 1,
  arrows: false,
  fade: true,
  asNavFor: '.slider-nav'
});
$('.slider-nav').slick({
  slidesToShow: 6,
  infinite: true,
  slidesToScroll: 1,
  asNavFor: '.slider-for',
  arrows: true,
  centerMode: false,
  focusOnSelect: true
});

问题是当我的滑块没有足够的幻灯片显示时(在我的情况下,6)如果滑块少于 6 张幻灯片,则不会显示箭头.

The problem is when my slider hasn't enough slides do show (in my case, 6) If the slider has less than 6 slides, the arrows don't show up.

我知道插件是这样工作的,但由于其他原因,我需要始终显示箭头.

I know the plugin works like that, but for other reasons, i need to always show the arrows.

以前有人遇到过这样的事情吗?

Anyone had to deal with something like that before ?

谢谢.

推荐答案

Make arrows:false and show arrow by your own

Make arrows:false and show arrow by your own

$('.container').slick({
   arrows: false,
});

并将事件附加到箭头上.

and attach the events to arrows.

$('.next-arrow').on('click', function(){
   $('.container').slick('slickNext');
});
$('.prev-arrow').on('click', function(){
   $('.container').slick('slickPrev');
});

这篇关于slickjs 总是显示箭头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆