本文介绍了将活动幻灯片居中,并在slick.js中显示3张幻灯片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用 slick.js
插件,我想在他们的网站上做类似的事情.这是演示.
I'm using slick.js
plugin and I want to make something like on their website. Here is DEMO.
问题是,第一个活动幻灯片 1
没有居中.我知道我可以使用
Problem is, that first active slide 1
is not centered. I know I can use
$('.slider-nav').slick({
slidesToShow: 3,
slidesToScroll: 1,
asNavFor: '.slider-for',
dots: true,
focusOnSelect: true,
centerMode: true
});
但是没有3张幻灯片,还有另外2张幻灯片的一部分,请参见这里
but then there are not 3 slides, but also parts of another 2 slides, see HERE
推荐答案
好吧,这太令人尴尬了.它所需要的只是将选项 centerPadding
设置为 0
.我不知道为什么我以前没看过.无论如何,这是我的1个月更新:
Well, this is so embarrassing. All it needs to have is set option centerPadding
to 0
. I don't know why I haven't seen this before. Anyway, here is my 1-month update:
WORKING DEMO
这篇关于将活动幻灯片居中,并在slick.js中显示3张幻灯片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!