Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,39 @@
</head>
<body>

<section class="vertical-center-max-height slider">
<div>
<img src="http://placehold.it/350x100?text=1">
</div>
<div>
<img src="http://placehold.it/350x100?text=2">
</div>
<div>
<img src="http://placehold.it/350x100?text=3">
</div>
<div>
<img src="http://placehold.it/350x100?text=4">
</div>
<div>
<img src="http://placehold.it/350x100?text=5">
</div>
<div>
<img src="http://placehold.it/350x100?text=6">
</div>
<div>
<img src="http://placehold.it/350x100?text=7">
</div>
<div>
<img src="http://placehold.it/350x100?text=8">
</div>
<div>
<img src="http://placehold.it/350x100?text=9">
</div>
<div>
<img src="http://placehold.it/350x100?text=10">
</div>
</section>

<section class="vertical-center-4 slider">
<div>
<img src="http://placehold.it/350x100?text=1">
Expand Down Expand Up @@ -312,6 +345,15 @@
<script src="./slick/slick.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
$(document).on('ready', function() {
$(".vertical-center-max-height").slick({
dots: true,
vertical: true,
verticalSwiping: true,
centerMode: true,
slidesToShow: 3,
slidesToScroll: 1,
maxHeight: 250
});
$(".vertical-center-4").slick({
dots: true,
vertical: true,
Expand Down
13 changes: 10 additions & 3 deletions slick/slick.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@
vertical: false,
verticalSwiping: false,
waitForAnimate: true,
zIndex: 1000
zIndex: 1000,
maxHeight: null
};

_.initials = {
Expand Down Expand Up @@ -117,7 +118,8 @@
$list: null,
touchObject: {},
transformsEnabled: false,
unslicked: false
unslicked: false,
listHeightFromSlides: 0,
};

$.extend(_, _.initials);
Expand Down Expand Up @@ -1132,6 +1134,10 @@
}
}

if (_.options.maxHeight !== null && _.listHeightFromSlides > _.options.maxHeight) {
verticalOffset = -((verticalHeight * _.options.slidesToShow) + (_.listHeightFromSlides - _.options.maxHeight) / 2);
}

if (_.slideCount <= _.options.slidesToShow) {
_.slideOffset = 0;
verticalOffset = 0;
Expand Down Expand Up @@ -2061,7 +2067,8 @@
});
}
} else {
_.$list.height(_.$slides.first().outerHeight(true) * _.options.slidesToShow);
_.listHeightFromSlides = _.$slides.first().outerHeight(true) * _.options.slidesToShow;
_.$list.height(_.options.maxHeight !== null && _.listHeightFromSlides > _.options.maxHeight ? _.options.maxHeight : _.listHeightFromSlides);
if (_.options.centerMode === true) {
_.$list.css({
padding: (_.options.centerPadding + ' 0px')
Expand Down