Animating Slides with CSS Transitions in Owl Carousel

Laptop showing a gallery slider mid-transition as one landscape fades into another

The default movement in Owl Carousel is a horizontal slide driven by CSS3 transforms. For hero banners and full-width galleries, a fade or a more distinctive entrance can suit the design better. The animation options make this possible with very little code.

Choosing the Right Effect

The default slide transition has a clear advantage: it shows spatial relationships. Visitors understand that the next slide sits to the right and the previous one to the left, which matches the arrows and swipe gestures. A fade removes that sense of direction, which suits content where order matters less, such as a set of atmospheric hero images, but can confuse visitors browsing a sequence.

Elaborate entrances such as flips, bounces and rotations attract attention, and that is precisely their weakness. Repeated every few seconds, they quickly become tiresome and distract from the content they frame. In most professional contexts a fade or a short, subtle movement achieves a polished result without drawing attention to itself.

The Two Animation Options

animateOut names a CSS class applied to the outgoing slide, and animateIn names a class applied to the incoming slide. Both take effect only when the carousel shows a single item at a time and the browser supports CSS transitions.

$(".owl-carousel").owlCarousel({
  items: 1,
  loop: true,
  animateOut: "fadeOut",
  animateIn: "fadeIn",
  smartSpeed: 450
});

The Built-In Fade

The core stylesheet already includes a fadeOut keyframe animation. Setting animateOut: "fadeOut" therefore produces a cross-fade without any additional library, which is often all a hero slider needs.

Using animate.css

For a wider range of effects, many projects pair the library with animate.css. The library adds the class animated alongside the names you supply, which matches the naming used by animate.css version 3. Version 4 prefixes every class with animate__, so either use version 3, use the compatibility build that version 4 provides, or supply prefixed names that your own CSS maps accordingly.

<link rel="stylesheet" href="css/animate.compat.css">

$(".owl-carousel").owlCarousel({
  items: 1,
  animateOut: "slideOutDown",
  animateIn: "flipInX"
});

Writing Your Own Keyframes

Custom animations need only a class with an animation name and a matching keyframe rule. The core stylesheet sets duration and fill mode on .owl-carousel .animated, so your class can focus on the motion itself.

.owl-carousel .zoomSoft {
  animation-name: zoomSoft;
}

@keyframes zoomSoft {
  from { opacity: 0; transform: scale(1.06); }
  to   { opacity: 1; transform: scale(1); }
}

Then set animateIn: "zoomSoft". To change the duration, override animation-duration on .owl-carousel .animated in your stylesheet.

Fine-Tuning Speed

The animation options control which effect runs, while speed options affect the sliding movement that remains in use for multi-item carousels and manual dragging. smartSpeed sets the default, fluidSpeed applies to fluid transitions, and dragEndSpeed controls how quickly a slide settles after a swipe. Keep durations between roughly 300 and 700 milliseconds so that motion feels deliberate without slowing navigation.

Practical Advice

  • Limit animations to one or two effects per site; variety quickly becomes distracting.
  • Avoid large-scale movement or rotation on content people need to read.
  • Disable animations when the visitor's system requests reduced motion.
  • Test on lower-powered phones, where heavy effects can stutter.

How Owl Carousel Applies Animation Classes

Understanding the mechanism helps when an animation does not run. When the carousel moves, the library adds animated owl-animated-out and your animateOut class to the outgoing item, and animated owl-animated-in with your animateIn class to the incoming one. When the CSS animation finishes, the library removes those classes. If no keyframes are defined for the class name you supplied, nothing visible happens, so a misspelt class or a missing stylesheet is the first thing to check.

Animating Content Inside Slides

Effects need not apply to the whole slide. Captions, headings and buttons can animate into view when their slide becomes active, which works with multi-item carousels as well. The library marks visible items with the class active, so CSS transitions can respond to it directly:

.owl-item .caption {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity .6s ease .3s, transform .6s ease .3s;
}

.owl-item.active .caption {
  opacity: 1;
  transform: none;
}

A Slow Zoom on Hero Slides

A gradual zoom on the active image, often called the Ken Burns effect, adds a sense of depth to full-width banners without distracting from the text above it:

.hero-slider .item { overflow: hidden; }

.hero-slider .item img {
  transform: scale(1);
  transition: transform 7s ease-out;
}

.hero-slider .owl-item.active .item img {
  transform: scale(1.08);
}

Pair the effect with an autoplayTimeout slightly longer than the transition, so that each zoom completes before the next slide appears.

Keeping Animations Smooth

Browsers animate transform and opacity far more efficiently than properties such as width, top or box-shadow, because those two can be handled by the graphics processor without recalculating layout. Restrict effects to them wherever possible. The will-change property can help on elements that animate constantly, but applying it widely consumes memory and may slow the page instead.

Honouring Reduced-Motion Preferences

Some visitors find animation uncomfortable. The prefers-reduced-motion media query lets your stylesheet remove decorative effects for them while leaving the carousel fully usable:

@media (prefers-reduced-motion: reduce) {
  .owl-carousel .animated,
  .owl-item .caption,
  .hero-slider .item img {
    animation: none !important;
    transition: none !important;
    transform: none !important;
  }
}

Key Takeaways

  • animateIn and animateOut work only on single-item carousels.
  • The core stylesheet already includes a fade.
  • Use animate.css version 3 or the compatibility build of version 4.
  • Animate only transform and opacity for smooth results.

Summary

Use the built-in fade for a quick improvement, animate.css or custom keyframes for something more distinctive, and keep every effect restrained. Animation should support the content rather than compete with it.