Using slick

Demo slick

Slick demo Besides listing things from top to bottom, we may sometimes put information into a left/right swipping carousel. Slick is a great one among thoes many carousel or slider library. The following is an example showing a trip planning with multiple days. Putting these day information into horizontal list makes the website more organized, and makes use of the common mobile swiping gesture.

See the Pen Example of using Slick by Thomas Seng Hin Mak (@makzan) on CodePen.

 1<div class="cards">
 2  <div class="card">
 3    <h2>Day 1</h2>
 4    <p>Blah Blah Blah...</p>
 5    <p>Blah Blah Blah...</p>
 6    <p>Blah Blah Blah...</p>
 7    <p>Blah Blah Blah...</p>
 8  </div>
 9  <div class="card">
10    <h2>Day 2</h2>
11    <p>Blah Blah Blah...</p>
12    <p>Blah Blah Blah...</p>
13    <p>Blah Blah Blah...</p>
14    <p>Blah Blah Blah...</p>
15  </div>
16  <div class="card">
17    <h2>Day 3</h2>
18    <p>Blah Blah Blah...</p>
19    <p>Blah Blah Blah...</p>
20    <p>Blah Blah Blah...</p>
21    <p>Blah Blah Blah...</p>
22  </div>
23</div>
1.card {
2  background: STEELBLUE;
3  color: #fefefe;
4  padding: 1rem;
5  margin: .8rem;
6}

This JavaScript library requires jQuery. We initialize the slick on specific element after the jQuery ready event. Center mode is important because it shows part of the neighbour cards. This lets user knows there are something on the side, so that user will swipe.

1$(function(){
2  $('.cards').slick({
3    centerMode: true,
4  });
5});

What’s next? We’re going to take a look at “Hammerjs”.

overlaied image when clicked on thumbnail

Makzan | Mobile web design | Table of Content