Migrating from Owl Carousel Version 1 to Version 2

Version 2 of Owl Carousel was a substantial rewrite rather than an incremental update. The markup remains familiar, but many option names, the responsive system, the stylesheets and the way scripts control the carousel all changed. This guide maps the differences so an upgrade can proceed methodically.
Why Migrate at All
Version 1 still functions on many sites, so the case for migrating deserves a clear statement. Version 2 introduced features that version 1 lacks, including genuine infinite looping with clones, centre mode, automatic widths, built-in video support, URL hash navigation and a richer set of events. It also uses CSS3 transforms more consistently, which improves smoothness on modern devices, and it is the version documented by the official site and distributed through npm and cdnjs.
There are also practical reasons. New developers joining a project are far more likely to know version 2, and most examples published online target it. Remaining on version 1 means translating every answer found elsewhere, which slowly increases the cost of maintenance.
Before You Start
Make a list of every page that uses the carousel and note the options each instance passes. Upgrading one instance at a time, with the old and new files kept in separate folders, makes problems far easier to isolate. Remember that version 2 recommends jQuery 1.8.3 or later, whereas version 1 worked with 1.7.
Replacing the Files
Version 1 shipped owl.carousel.css, owl.theme.css and owl.transitions.css. Version 2 replaces these with owl.carousel.min.css and a choice of theme files such as owl.theme.default.min.css. The transitions stylesheet no longer exists; animations are handled through the animateIn and animateOut options.
Option Mapping
| Version 1 | Version 2 |
|---|---|
| items, itemsDesktop, itemsTablet, itemsMobile | responsive object keyed by minimum width |
| singleItem: true | items: 1 |
| navigation | nav |
| navigationText | navText |
| pagination | dots |
| autoPlay (true or milliseconds) | autoplay plus autoplayTimeout |
| stopOnHover | autoplayHoverPause |
| slideSpeed | smartSpeed |
| rewindNav | rewind |
| scrollPerPage | slideBy: "page" |
| transitionStyle | animateOut and animateIn |
| lazyLoad with class lazyOwl | lazyLoad with class owl-lazy |
Converting Responsive Settings
Version 1 expressed breakpoints as maximum widths in arrays such as itemsTablet: [768, 2]. Version 2 uses minimum widths in an object. Translate each array by adding one pixel to the width and moving it to the next range up:
// Version 1
items: 4,
itemsTablet: [768, 2],
itemsMobile: [479, 1]
// Version 2
responsive: {
0: { items: 1 },
480: { items: 2 },
769: { items: 4 }
}
Callbacks and Methods
Version 1 callbacks such as afterMove and beforeMove become event listeners or on-prefixed options in version 2, for example onTranslated and onTranslate. Direct method calls change as well. Code that previously retrieved the instance and called a method now triggers a namespaced event:
// Version 1
var owl = $("#owl").data("owlCarousel");
owl.next();
owl.goTo(3);
// Version 2
$("#owl").trigger("next.owl.carousel");
$("#owl").trigger("to.owl.carousel", [3]);
Markup and Theme Classes
Add the class owl-theme to each carousel container if you rely on the default theme, since version 2 applies theme styles through that class. Review any custom CSS that targets version 1 selectors such as .owl-controls .owl-buttons div; version 2 renders controls inside .owl-nav and .owl-dots as button elements.
Testing the Result
- Compare item counts at each breakpoint against the original layout.
- Check that autoplay timing and hover pausing match previous behaviour.
- Confirm lazy-loaded images use the new class name.
- Verify that any script counting items accounts for clones when looping.
Updating Custom CSS Selectors
Version 2 renamed the elements it generates, so any stylesheet written for version 1 needs its selectors updated. The most common replacements are these:
| Version 1 selector | Version 2 selector |
|---|---|
| .owl-wrapper-outer | .owl-stage-outer |
| .owl-wrapper | .owl-stage |
| .owl-controls .owl-buttons .owl-prev | .owl-nav .owl-prev |
| .owl-controls .owl-buttons .owl-next | .owl-nav .owl-next |
| .owl-pagination | .owl-dots |
| .owl-pagination .owl-page span | .owl-dots .owl-dot span |
The class .owl-item keeps its name, and version 2 adds useful state classes to it, such as active for visible items, cloned for loop clones and center in centre mode.
Version 1 and Version 2 Cannot Share a Page
Both versions register themselves under the same jQuery method name, owlCarousel. Whichever script loads last replaces the other, so you cannot run old and new carousels side by side on a single page. Migrate page templates one at a time instead, loading only the version each template requires.
Upgrading jQuery at the Same Time
Projects that still use version 1 often run an old release of jQuery as well. If you upgrade jQuery during the migration, load the jQuery Migrate script temporarily. It restores many removed features and logs a console warning each time one is used, giving you a clear list of other code that needs attention. Remove it once the warnings stop appearing.
A Migration Checklist
- Record every page and the options each carousel uses.
- Replace the version 1 scripts and stylesheets with the version 2 files.
- Add
owl-themeto each container that relies on the default theme. - Translate option names using the mapping table.
- Convert maximum-width breakpoint arrays into a
responsiveobject. - Replace callbacks with events and method calls with triggered events.
- Rename
lazyOwlimage classes toowl-lazy. - Update custom CSS selectors.
- Test each page on phones, tablets and desktops before moving to the next.
Key Takeaways
- Version 1 and version 2 cannot run on the same page.
- Translate options with the mapping table and breakpoints to minimum widths.
- Replace method calls with triggered events.
- Update custom CSS selectors for the new element names.
Summary
Swap the files, translate the options using the table above, convert breakpoints to minimum widths and replace direct method calls with triggered events. Working through each instance in turn keeps the upgrade manageable.


