Overview
Slick Carousel provides extensive configuration options to customize the behavior and appearance of your carousel. This guide covers initialization methods, common settings, and how different options work together.Initialization
Basic Initialization
The most basic way to initialize Slick is using jQuery:Data Attribute Initialization
As of Slick 1.5, you can add settings using thedata-slick attribute. You still need to call $(element).slick() to initialize:
When using data attributes, ensure your JSON is properly formatted with double quotes and escaped correctly.
Core Settings
Display Options
Number of slides to show at a time. Controls how many slides are visible in the viewport.
Number of slides to scroll at a time when navigating. Works in conjunction with
slidesToShow.Enables infinite looping. When enabled, the carousel will continuously loop through slides.
Slide to start on. Zero-indexed, so
0 is the first slide.Navigation Controls
Enable Next/Prev navigation arrows.
Customize the HTML for the “Previous” arrow. Accepts an HTML string, jQuery selector, or DOM node.
Customize the HTML for the “Next” arrow. Accepts an HTML string, jQuery selector, or DOM node.
Show dot indicators for slide navigation.
Class name for the dots container element.
Animation Settings
Transition speed in milliseconds. From source code: default is
500ms (Note: README states 300, but source shows 500).Enable fade effect. When enabled, slides will fade in/out instead of sliding.
CSS3 easing function for transitions. Examples:
'ease', 'linear', 'ease-in', 'ease-out', 'ease-in-out'.jQuery animate() fallback easing for browsers without CSS transitions.
Enable or disable CSS transitions. When disabled, falls back to jQuery animations.
Enable or disable CSS transforms for slide positioning.
Autoplay
Enable automatic slide advancement.
Autoplay interval in milliseconds. Delay between automatic slide changes.
Pause autoplay when hovering over the slider.
Pause autoplay when the slider receives focus.
Pause autoplay when hovering over dot navigation.
Center Mode
Enable centered view with partial prev/next slides. Best used with odd numbered
slidesToShow counts.Side padding when in center mode. Accepts pixel or percentage values.
Advanced Settings
Adaptive Height
Adapt slider height to the current slide. Useful when slides have varying heights.
Variable Width
Disable automatic slide width calculation. Allows slides to have custom widths defined via CSS.
Grid Mode
Setting this to more than 1 initializes grid mode. Creates a grid layout with multiple rows.
With grid mode initialized via the
rows option, this sets how many slides are in each grid row.Interaction Settings
Enable desktop mouse dragging.
Enable touch swipe gestures on mobile devices.
Allow swiping to any slide irrespective of
slidesToScroll. When enabled, users can swipe directly to any slide.Enable slide movement with touch gestures.
To advance slides, the user must swipe a length of
(1/touchThreshold) * slider width.Resistance when swiping edges of non-infinite carousels. From source: default is
0.35 (not 0.15 as in some docs).Ignore requests to advance the slide while currently animating.
Focus and Selection
Enable focus on selected element when clicked.
Put focus on slide after change. Works with accessibility features.
Syncing Sliders
Enable syncing of multiple sliders. Accepts a jQuery selector for the target slider.
RTL Support
Change the slider’s direction to right-to-left for RTL languages.
Vertical Mode
Enable vertical slide direction.
Change swipe direction to vertical. Should be enabled when using
vertical: true.Lazy Loading
Lazy load technique. Accepts
'ondemand' or 'progressive'.'ondemand': Load the image as soon as you slide to it'progressive': Load one image after the other when the page loads
Custom Paging
Custom paging template function. Receives the slider instance and index, returns a jQuery element for each dot.Default:
function(slider, i) { return $('<button type="button"></button>').text(i + 1); }Attachment Points
Change where navigation arrows are attached. Accepts a selector, HTML string, array, element, or jQuery object.
Change where navigation dots are attached. Accepts a selector, HTML string, array, element, or jQuery object.
Z-Index
Set the z-index values for slides. Useful for IE9 and lower.
How Settings Work Together
Center Mode with Multiple Slides
Center Mode with Multiple Slides
When using This creates a centered view with partial slides visible on both sides.
centerMode with multiple slidesToShow, use odd numbers for best results:Fade Effect Limitations
Fade Effect Limitations
The
fade option only works properly with slidesToShow: 1:Infinite Mode with Few Slides
Infinite Mode with Few Slides
When you have fewer slides than
slidesToShow, infinite mode still works but behavior changes:SwipeToSlide with SlidesToScroll
SwipeToSlide with SlidesToScroll
When
swipeToSlide: true, it overrides the slidesToScroll setting:Common Configuration Patterns
Simple Image Gallery
Product Carousel
Hero Slider with Autoplay
Testimonial Slider
Updating Settings Dynamically
You can change settings after initialization using theslickSetOption method:
For responsive settings, see the Responsive Design documentation.
Best Practices
Performance Optimization
- Enable
lazyLoadfor image-heavy carousels - Use
waitForAnimate: trueto prevent animation stacking - Consider disabling
useCSSfor complex animations on older browsers - Use
useTransform: truefor smoother hardware-accelerated animations
User Experience
- Enable
accessibility: truefor keyboard navigation - Set
pauseOnHover: truefor autoplay sliders - Use
adaptiveHeight: truewhen slide content varies in height - Provide custom arrow and dot styles for better visual feedback
Mobile Optimization
- Enable
swipeandtouchMovefor mobile devices - Adjust
touchThresholdfor swipe sensitivity - Consider using
mobileFirst: truefor responsive breakpoints - Test
edgeFrictionvalues for non-infinite carousels
Related Configuration
- Responsive Design - Configure breakpoint-specific settings
- Accessibility - Accessibility-related configuration options
- Settings Reference - Complete list of all settings
- Methods - Control your slider programmatically
- Events - Hook into slider events