Convert Figma logo to code with AI

kenwheeler logoslick

the last carousel you'll ever need

28,515
5,882
28,515
1,390

Top Related Projects

39,745

Most modern mobile touch slider with hardware accelerated transitions

7,299

A dependency-free JavaScript ES6 slider and carousel. It’s lightweight, flexible and fast. Designed to slide. No less, no more

4,864

Splide is a lightweight, flexible and accessible slider/carousel written in TypeScript. No dependencies, no Lighthouse errors.

JQuery lightSlider is a lightweight responsive Content slider with carousel thumbnails navigation

A lightweight carousel library with fluid motion and great swipe precision.

Quick Overview

Slick is a responsive carousel jQuery plugin that supports multiple breakpoints, CSS3 transitions, touch events, and more. It's designed to be flexible, customizable, and easy to use, making it a popular choice for creating image sliders and content carousels on websites.

Pros

  • Highly customizable with numerous options and settings
  • Responsive design with support for multiple breakpoints
  • Smooth animations and touch-friendly for mobile devices
  • Actively maintained with regular updates and bug fixes

Cons

  • Requires jQuery, which may be a drawback for projects not using this library
  • Can be resource-intensive for large carousels with many slides
  • Some advanced features may require additional configuration or custom CSS
  • Documentation could be more comprehensive for complex use cases

Code Examples

  1. Basic initialization:
$('.your-class').slick();
  1. Customized carousel with options:
$('.your-class').slick({
  dots: true,
  infinite: true,
  speed: 300,
  slidesToShow: 3,
  slidesToScroll: 1,
  responsive: [
    {
      breakpoint: 1024,
      settings: {
        slidesToShow: 2,
        slidesToScroll: 1,
        infinite: true,
        dots: true
      }
    },
    {
      breakpoint: 600,
      settings: {
        slidesToShow: 1,
        slidesToScroll: 1
      }
    }
  ]
});
  1. Using methods to control the carousel:
// Go to the next slide
$('.your-class').slick('slickNext');

// Go to a specific slide (zero-based index)
$('.your-class').slick('slickGoTo', 3);

// Pause autoplay
$('.your-class').slick('slickPause');

Getting Started

  1. Include the required files in your HTML:
<link rel="stylesheet" type="text/css" href="slick/slick.css"/>
<link rel="stylesheet" type="text/css" href="slick/slick-theme.css"/>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="slick/slick.min.js"></script>
  1. Create your HTML structure:
<div class="your-class">
  <div>Slide 1</div>
  <div>Slide 2</div>
  <div>Slide 3</div>
</div>
  1. Initialize Slick in your JavaScript:
$(document).ready(function(){
  $('.your-class').slick({
    // Your options here
  });
});

Competitor Comparisons

39,745

Most modern mobile touch slider with hardware accelerated transitions

Pros of Swiper

  • More modern and actively maintained, with frequent updates and new features
  • Better support for mobile devices and touch interactions
  • Offers a wider range of customization options and plugins

Cons of Swiper

  • Larger file size, which may impact page load times
  • Steeper learning curve due to more complex API and configuration options
  • Requires more setup and configuration compared to Slick's simpler approach

Code Comparison

Slick initialization:

$('.slider').slick({
  slidesToShow: 3,
  slidesToScroll: 1,
  autoplay: true
});

Swiper initialization:

const swiper = new Swiper('.swiper-container', {
  slidesPerView: 3,
  spaceBetween: 30,
  autoplay: {
    delay: 2500,
    disableOnInteraction: false,
  },
});

Both libraries offer similar basic functionality, but Swiper provides more granular control over slider behavior and appearance. Slick's syntax is more concise and easier to implement for simple use cases, while Swiper's initialization requires more detailed configuration but offers greater flexibility.

7,299

A dependency-free JavaScript ES6 slider and carousel. It’s lightweight, flexible and fast. Designed to slide. No less, no more

Pros of Glide

  • Lightweight and modular design, with a smaller file size
  • More flexible and customizable, allowing for easier extension
  • Better performance, especially for complex carousel configurations

Cons of Glide

  • Smaller community and fewer resources compared to Slick
  • Less out-of-the-box features and pre-built components
  • Steeper learning curve for beginners

Code Comparison

Slick initialization:

$('.slider').slick({
  slidesToShow: 3,
  slidesToScroll: 1,
  autoplay: true,
  autoplaySpeed: 2000,
});

Glide initialization:

new Glide('.slider', {
  type: 'carousel',
  perView: 3,
  autoplay: 2000,
}).mount();

Both Slick and Glide offer similar basic functionality for creating carousels and sliders. Slick uses a jQuery-based approach, while Glide is a vanilla JavaScript library. Glide's initialization is more concise and doesn't require jQuery.

Slick provides more built-in options and is easier to set up for common use cases. Glide, on the other hand, offers a more modular structure that allows for greater customization and flexibility.

Overall, Slick is better suited for quick implementations and projects that already use jQuery, while Glide is ideal for developers who prefer a lightweight, customizable solution without jQuery dependencies.

4,864

Splide is a lightweight, flexible and accessible slider/carousel written in TypeScript. No dependencies, no Lighthouse errors.

Pros of Splide

  • Lightweight and performant, with a smaller file size than Slick
  • More modern codebase with TypeScript support and better documentation
  • Offers additional features like lazy loading and intersection observer support

Cons of Splide

  • Fewer pre-built themes and customization options compared to Slick
  • Less widespread adoption and community support
  • May require more manual configuration for complex use cases

Code Comparison

Slick initialization:

$('.slider').slick({
  slidesToShow: 3,
  slidesToScroll: 1,
  autoplay: true,
  autoplaySpeed: 2000,
});

Splide initialization:

new Splide('.splide', {
  perPage: 3,
  perMove: 1,
  autoplay: true,
  interval: 2000,
}).mount();

Both libraries offer similar functionality for creating responsive carousels, but Splide uses a more modern JavaScript approach without jQuery dependency. Slick's syntax may be more familiar to developers accustomed to jQuery plugins, while Splide's API is designed for modern JavaScript practices.

JQuery lightSlider is a lightweight responsive Content slider with carousel thumbnails navigation

Pros of lightSlider

  • Smaller file size (11KB minified) compared to Slick's 54KB
  • Built-in responsive features without additional plugins
  • Supports touch events out of the box for mobile devices

Cons of lightSlider

  • Less active development and community support
  • Fewer customization options and advanced features
  • Limited documentation compared to Slick's extensive guides

Code Comparison

lightSlider initialization:

$("#lightSlider").lightSlider({
    item: 3,
    autoWidth: false,
    slideMove: 1,
    slideMargin: 10
});

Slick initialization:

$(".slider").slick({
    slidesToShow: 3,
    slidesToScroll: 1,
    autoplay: true,
    autoplaySpeed: 2000
});

Both libraries offer similar basic functionality, but Slick provides more options for customization and advanced features. lightSlider's code is more concise, while Slick's initialization allows for more detailed configuration.

lightSlider is a lightweight option suitable for simple slider needs, especially on mobile-friendly sites. Slick, while larger in size, offers more robust features and better documentation, making it ideal for complex slider requirements and projects that need extensive customization.

A lightweight carousel library with fluid motion and great swipe precision.

Pros of Embla Carousel

  • Lightweight and performant, with a smaller bundle size
  • Supports touch gestures and smooth animations out of the box
  • Highly customizable with a plugin system for extended functionality

Cons of Embla Carousel

  • Less mature ecosystem compared to Slick, with fewer community-contributed resources
  • May require more initial setup and configuration for advanced use cases
  • Limited built-in responsive options, requiring more manual adjustments

Code Comparison

Slick initialization:

$('.slider').slick({
  slidesToShow: 3,
  slidesToScroll: 1,
  autoplay: true,
  autoplaySpeed: 2000,
});

Embla Carousel initialization:

const embla = EmblaCarousel(document.querySelector('.embla'), {
  slidesToScroll: 1,
  align: 'center',
  loop: true,
});

Both carousels offer simple initialization, but Embla Carousel uses a more modern, vanilla JavaScript approach. Slick relies on jQuery, which may be a consideration for projects aiming to reduce dependencies. Embla Carousel provides more granular control over options and behavior, while Slick offers a wider range of built-in features that can be easily enabled through configuration.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

slick

the last carousel you'll ever need

Demo

http://kenwheeler.github.io/slick

CDN

To start working with Slick right away, there's a couple of CDN choices available to serve the files as close, and fast as possible to your users:

Example using jsDelivr

Just add a link to the css file in your <head>:

<!-- Add the slick-theme.css if you want default styling -->
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/slick-carousel@1.8.1/slick/slick.css"/>
<!-- Add the slick-theme.css if you want default styling -->
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/slick-carousel@1.8.1/slick/slick-theme.css"/>

Then, before your closing <body> tag add:

<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/slick-carousel@1.8.1/slick/slick.min.js"></script>

Package Managers

# Bower
bower install --save slick-carousel

# NPM
npm install slick-carousel

Contributing

PLEASE review CONTRIBUTING.markdown prior to requesting a feature, filing a pull request or filing an issue.

Data Attribute Settings

In slick 1.5 you can now add settings using the data-slick attribute. You still need to call $(element).slick() to initialize slick on the element.

Example:

<div data-slick='{"slidesToShow": 4, "slidesToScroll": 4}'>
  <div><h3>1</h3></div>
  <div><h3>2</h3></div>
  <div><h3>3</h3></div>
  <div><h3>4</h3></div>
  <div><h3>5</h3></div>
  <div><h3>6</h3></div>
</div>

Settings

OptionTypeDefaultDescription
accessibilitybooleantrueEnables tabbing and arrow key navigation. Unless autoplay: true, sets browser focus to current slide (or first of current slide set, if multiple slidesToShow) after slide change. For full a11y compliance enable focusOnChange in addition to this.
adaptiveHeightbooleanfalseAdapts slider height to the current slide
appendArrowsstring$(element)Change where the navigation arrows are attached (Selector, htmlString, Array, Element, jQuery object)
appendDotsstring$(element)Change where the navigation dots are attached (Selector, htmlString, Array, Element, jQuery object)
arrowsbooleantrueEnable Next/Prev arrows
asNavForstring$(element)Enables syncing of multiple sliders
autoplaybooleanfalseEnables auto play of slides
autoplaySpeedint3000Auto play change interval
centerModebooleanfalseEnables centered view with partial prev/next slides. Use with odd numbered slidesToShow counts.
centerPaddingstring'50px'Side padding when in center mode. (px or %)
cssEasestring'ease'CSS3 easing
customPagingfunctionn/aCustom paging templates. See source for use example.
dotsbooleanfalseCurrent slide indicator dots
dotsClassstring'slick-dots'Class for slide indicator dots container
draggablebooleantrueEnables desktop dragging
easingstring'linear'animate() fallback easing
edgeFrictioninteger0.15Resistance when swiping edges of non-infinite carousels
fadebooleanfalseEnables fade
focusOnSelectbooleanfalseEnable focus on selected element (click)
focusOnChangebooleanfalsePuts focus on slide after change
infinitebooleantrueInfinite looping
initialSlideinteger0Slide to start on
lazyLoadstring'ondemand'Accepts 'ondemand' or 'progressive' for lazy load technique. 'ondemand' will load the image as soon as you slide to it, 'progressive' loads one image after the other when the page loads.
mobileFirstbooleanfalseResponsive settings use mobile first calculation
nextArrowstring (html | jQuery selector) | object (DOM node | jQuery object)<button type="button" class="slick-next">Next</button>Allows you to select a node or customize the HTML for the "Next" arrow.
pauseOnDotsHoverbooleanfalsePauses autoplay when a dot is hovered
pauseOnFocusbooleantruePauses autoplay when slider is focussed
pauseOnHoverbooleantruePauses autoplay on hover
prevArrowstring (html | jQuery selector) | object (DOM node | jQuery object)<button type="button" class="slick-prev">Previous</button>Allows you to select a node or customize the HTML for the "Previous" arrow.
respondTostring'window'Width that responsive object responds to. Can be 'window', 'slider' or 'min' (the smaller of the two).
responsivearraynullArray of objects containing breakpoints and settings objects (see example). Enables settings at given breakpoint. Set settings to "unslick" instead of an object to disable slick at a given breakpoint.
rowsint1Setting this to more than 1 initializes grid mode. Use slidesPerRow to set how many slides should be in each row.
rtlbooleanfalseChange the slider's direction to become right-to-left
slidestring''Slide element query
slidesPerRowint1With grid mode initialized via the rows option, this sets how many slides are in each grid row.
slidesToScrollint1# of slides to scroll at a time
slidesToShowint1# of slides to show at a time
speedint300Transition speed
swipebooleantrueEnables touch swipe
swipeToSlidebooleanfalseSwipe to slide irrespective of slidesToScroll
touchMovebooleantrueEnables slide moving with touch
touchThresholdint5To advance slides, the user must swipe a length of (1/touchThreshold) * the width of the slider.
useCSSbooleantrueEnable/Disable CSS Transitions
useTransformbooleantrueEnable/Disable CSS Transforms
variableWidthbooleanfalseDisables automatic slide width calculation
verticalbooleanfalseVertical slide direction
verticalSwipingbooleanfalseChanges swipe direction to vertical
waitForAnimatebooleantrueIgnores requests to advance the slide while animating
zIndexnumber1000Set the zIndex values for slides, useful for IE9 and lower
Responsive Option Example

The responsive option, and value, is quite unique and powerful. You can use it like so:

$(".slider").slick({

  // normal options...
  infinite: false,

  // the magic
  responsive: [{

      breakpoint: 1024,
      settings: {
        slidesToShow: 3,
        infinite: true
      }

    }, {

      breakpoint: 600,
      settings: {
        slidesToShow: 2,
        dots: true
      }

    }, {

      breakpoint: 300,
      settings: "unslick" // destroys slick

    }]
});

Events

In slick 1.4, callback methods were deprecated and replaced with events. Use them before the initialization of slick as shown below:

// On swipe event
$('.your-element').on('swipe', function(event, slick, direction){
  console.log(direction);
  // left
});

// On edge hit
$('.your-element').on('edge', function(event, slick, direction){
  console.log('edge was hit')
});

// On before slide change
$('.your-element').on('beforeChange', function(event, slick, currentSlide, nextSlide){
  console.log(nextSlide);
});
EventParamsDescription
afterChangeevent, slick, currentSlideAfter slide change callback
beforeChangeevent, slick, currentSlide, nextSlideBefore slide change callback
breakpointevent, slick, breakpointFires after a breakpoint is hit
destroyevent, slickWhen slider is destroyed, or unslicked.
edgeevent, slick, directionFires when an edge is overscrolled in non-infinite mode.
initevent, slickWhen Slick initializes for the first time callback. Note that this event should be defined before initializing the slider.
reInitevent, slickEvery time Slick (re-)initializes callback
setPositionevent, slickEvery time Slick recalculates position
swipeevent, slick, directionFires after swipe/drag
lazyLoadedevent, slick, image, imageSourceFires after image loads lazily
lazyLoadErrorevent, slick, image, imageSourceFires after image fails to load

Methods

Methods are called on slick instances through the slick method itself in version 1.4, see below:

// Add a slide
$('.your-element').slick('slickAdd',"<div></div>");

// Get the current slide
var currentSlide = $('.your-element').slick('slickCurrentSlide');

This new syntax allows you to call any internal slick method as well:

// Manually refresh positioning of slick
$('.your-element').slick('setPosition');
MethodArgumentDescription
slickoptions : objectInitializes Slick
unslickDestroys Slick
slickNextTriggers next slide
slickPrevTriggers previous slide
slickPausePause Autoplay
slickPlayStart Autoplay (will also set autoplay option to true)
slickGoToindex : int, dontAnimate : boolGoes to slide by index, skipping animation if second parameter is set to true
slickCurrentSlideReturns the current slide index
slickAddelement : html or DOM object, index: int, addBefore: boolAdd a slide. If an index is provided, will add at that index, or before if addBefore is set. If no index is provided, add to the end or to the beginning if addBefore is set. Accepts HTML String
slickRemoveindex: int, removeBefore: boolRemove slide by index. If removeBefore is set true, remove slide preceding index, or the first slide if no index is specified. If removeBefore is set to false, remove the slide following index, or the last slide if no index is set.
slickFilterfilter : selector or functionFilters slides using jQuery .filter syntax
slickUnfilterRemoves applied filter
slickGetOptionoption : string(option name)Gets an option value.
slickSetOptionchange an option, refresh is always boolean and will update UI changes...
option, value, refreshchange a single option to given value; refresh is optional.
"responsive", [{ breakpoint: n, settings: {} }, ... ], refreshchange or add whole sets of responsive options
{ option: value, option: value, ... }, refreshchange multiple options to corresponding values.

Example

Initialize with:

$(element).slick({
  dots: true,
  speed: 500
});

Change the speed with:

$(element).slick('slickSetOption', 'speed', 5000, true);

Destroy with:

$(element).slick('unslick');

Sass Variables

VariableTypeDefaultDescription
$slick-font-pathstring"./fonts/"Directory path for the slick icon font
$slick-font-familystring"slick"Font-family for slick icon font
$slick-loader-pathstring"./"Directory path for the loader image
$slick-arrow-colorcolorwhiteColor of the left/right arrow icons
$slick-dot-colorcolorblackColor of the navigation dots
$slick-dot-color-activecolor$slick-dot-colorColor of the active navigation dot
$slick-prev-characterstring'\2190'Unicode character code for the previous arrow icon
$slick-next-characterstring'\2192'Unicode character code for the next arrow icon
$slick-dot-characterstring'\2022'Unicode character code for the navigation dot icon
$slick-dot-sizepixels6pxSize of the navigation dots

Browser support

Slick works on IE8+ in addition to other modern browsers such as Chrome, Firefox, and Safari.

Dependencies

jQuery 1.7

License

Copyright (c) 2017 Ken Wheeler

Licensed under the MIT license.

Free as in Bacon.

NPM DownloadsLast 30 Days