To get fade out effect just set:
animateOut: 'fadeOut'
fadeOut
value is the only built-in CSS animate style. However there are tons of additional CSS animations that you can use in Owl. Simply download animate.css library and you are ready to extend Owl with new fancy transitions.
Animate functions work only with one item and only in browsers that support perspective property.
animate.css
libraryanimateOut
and animateIn
options with the style names you picked.$('.custom1').owlCarousel({
animateOut: 'slideOutDown',
animateIn: 'flipInX',
items:1,
margin:30,
stagePadding:30,
smartSpeed:450
});
Example with slideOutDown and flipInX
Before animation starts three classes are added to each item:
Part of owl.carousel.css:
/* Feel free to change duration */
.animated {
-webkit-animation-duration : 1000 ms ;
animation-duration : 1000 ms ;
-webkit-animation-fill-mode : both ;
animation-fill-mode : both ;
}
/* .owl-animated-out - only for current item */
/* This is very important class. Use z-index if you want move Out item above In item */
.owl-animated-out {
z-index : 1
}
/* .owl-animated-in - only for upcoming item
/* This is very important class. Use z-index if you want move In item above Out item */
.owl-animated-in {
z-index : 0
}
/* .fadeOut is style taken from Animation.css and this is how it looks in owl.carousel.css: */
.fadeOut {
-webkit-animation-name : fadeOut ;
animation-name : fadeOut ;
}
@-webkit-keyframes fadeOut {
0% {
opacity : 1 ;
}
100% {
opacity : 0 ;
}
}
@keyframes fadeOut {
0% {
opacity : 1 ;
}
100% {
opacity : 0 ;
}
}