jQuery Slider – How to implement a jQuery Slider

jQuery Slider – How to implement a jQuery Slider

In this example we will use slick slider because is fully responsive and is very customizable you can move arrows/dots when you need with built in functionality, or you can create your own html for arrows and so on.

Basically all you need to initialize the slick slider is the following line of codeĀ 


There are a lot of settings you can use from slick slider such as: responsive (for every breakpoint you need), how many slides to show or to scroll, you can activate or dezactivate the swipe on mobile or drag on desktop, is fully customizable, I mean you can add your own effects when new slide comes.

In our example we will construct a basic slider with 3 slides.

We will use the following HTML structure:

<div class="main-slick-slider">
  <div class="item item1">
    <p>Slide 1<p>
  <div class="item item2">
    <p>Slide 2<p>
  <div class="item item3">
    <p>Slide 3<p>


On the main-slick-slider we will initialize the slider. The slider will automatically create 3 slides because it has three direct childrens, if you need to target other class you can to this from slick settings.


.main-slick-slider .item{
.main-slick-slider .item p{
   transform:translateX(-50%) translateY(-50%);
.main-slick-slider .item1{background:#fff;}
.main-slick-slider .item2{background:#f2f2f2;}
.main-slick-slider .item3{background:#3b3b3b;}


It's all clear in our css we used there translateX and translateY a css3 declaration with which help to center vertically and horizontally the <p> element. In other words translateX pull the element half of its size to the left, and translateY pull the element half of its size to the top, because we used -50%.





We used here few settings of slider you can see the rest of them on their website.

Slide 1

Slide 2

Slide 3

Leave a Reply

Your email address will not be published. Required fields are marked *