Overview
This guide helps you migrate between different versions of Slick Carousel, highlighting breaking changes and new features.Migrating to Slick 1.4+
Version 1.4 introduced significant changes to the API, particularly around callbacks and methods.Breaking Change: Callbacks → Events
This is the most significant change when upgrading from pre-1.4 versions.Before (< 1.4): Callback Methods
After (1.4+): Event-Based System
Important: Events must be bound before initializing Slick, especially for the
init event.Complete Callback → Event Mapping
All Event Conversions
All Event Conversions
| Old Callback (< 1.4) | New Event (1.4+) | Parameters |
|---|---|---|
onAfterChange | afterChange | event, slick, currentSlide |
onBeforeChange | beforeChange | event, slick, currentSlide, nextSlide |
onInit | init | event, slick |
onReInit | reInit | event, slick |
onSetPosition | setPosition | event, slick |
onSwipe | swipe | event, slick, direction |
onEdge | edge | event, slick, direction |
onLazyLoaded | lazyLoaded | event, slick, image, imageSource |
onLazyLoadError | lazyLoadError | event, slick, image, imageSource |
New Events in 1.4+
Version 1.4+ introduced additional events not available as callbacks:Method Syntax Change
In version 1.4+, the method calling syntax became more consistent:Before (< 1.4)
After (1.4+)
The new syntax allows you to call any internal Slick method, providing more flexibility.
Migrating to Slick 1.5+
Data Attribute Settings
Slick 1.5 introduced the ability to configure settings viadata-slick attribute:
You still need to call
$(element).slick() to initialize Slick, even when using data attributes.Migrating to Slick 1.8+
Slick 1.8 is the current stable version with minor improvements and bug fixes.What’s New in 1.8
- Improved accessibility features
- Better touch handling on mobile devices
- Various bug fixes and performance improvements
- Enhanced responsive behavior
Breaking Changes
No major breaking changes from 1.7 to 1.8. Most code should work without modifications.Step-by-Step Migration Process
Test Thoroughly
Test all carousel functionality:
- Slide navigation
- Autoplay
- Responsive breakpoints
- Event handlers
- Dynamic content updates
Common Migration Issues
Events not firing
Events not firing
Problem: Event handlers don’t execute.Solution: Ensure events are bound before calling
.slick():Init event not triggering
Init event not triggering
Problem: The
init event doesn’t fire.Solution: Bind the init event before initialization:Method calls failing
Method calls failing
Problem: Method calls return undefined or throw errors.Solution: Use the correct 1.4+ method syntax:
Parameter order confusion
Parameter order confusion
Problem: Event parameters are different from callback parameters.Solution: Note that events include the
event object as the first parameter:Migration Checklist
Pre-Migration Checklist
Pre-Migration Checklist
- Backup current implementation
- Document all custom callbacks
- Identify all method calls
- Check jQuery version compatibility
- Review custom CSS modifications
- Note any third-party integrations
Post-Migration Checklist
Post-Migration Checklist
- All events fire correctly
- Method calls work as expected
- Responsive breakpoints function properly
- Autoplay works correctly
- Keyboard navigation works
- Touch/swipe gestures work on mobile
- Custom styling still applies
- Performance is acceptable
- Cross-browser testing complete
Example: Complete Migration
Before (Pre-1.4)
After (1.4+)
Getting Help
If you encounter issues during migration:Troubleshooting
Common issues and solutions
Community Support
Ask questions on Stack Overflow