Menu Close

Slick Slider Image Autoplay With Example

Image auto play

Here, we will learn how to create a slick slider with image carousel autoplay using html, css and jquery. Follow the below snippet to develop slick slider image autoplay with the responsive design.

HTML:

<!DOCTYPE html>
<html lang="en">
<head>
    <link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.5.9/slick.min.css"/>
    <link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.5.9/slick-theme.min.css"/>
    <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
    <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.8.1/slick.min.js"></script>
    <link rel="stylesheet" type="text/css" href="style3.css"/>
    <title>Slick Slider Image Autoplay</title>
</head>
<body>
<div class="main">
  <div class="slider slide-show">
    <div class="img-wish">
        <img src="img1.png" >
        </div>
    <div class="img-wish">
        <img src="img2.png" >
        </div>
    <div class="img-wish">
        <img src="img3.png" >
        </div>
    <div class="img-wish">
        <img src="img1.png" >
        </div>
    <div class="img-wish">
        <img src="img2.png" >
        </div>
    <div class="img-wish">
        <img src="img3.png" >
        </div>
  </div>
</div>
</body>  
    <script>
        $('.slide-show').slick({
            slidesToShow: 3,
            slidesToScroll: 3,
            arrows: true, 
            dots: true,
            autoplay: true,
            autoplaySpeed: 2000
        });
    </script>
</html> 

CSS:

Create an external stylesheet and add it to the above example to view the responsive design.

body{
    background:#ccc;
}
.main {
    width: 800px;
    display:block;
    margin:0 auto;
}
.img-wish{text-align: center !important;}
.img-wish img{width: 100%;} 

More examples for slick slider

Posted in HTML, JavaScript, jQuery

You can also read...