Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use owl carousel vertically?

I did not want to take the plugin code so I was wondering if someone had already managed to use plugin vertically. It's a shame on the part of this plugin can be used horizontally. Sorry for langage...

like image 579
user3822650 Avatar asked Aug 01 '14 11:08

user3822650


4 Answers

You could rotate the carousel and then rotate the items back, like this:

$(document).ready(function() {
  $(".owl-carousel").owlCarousel({
    items: 3,
    loop: false,
    mouseDrag: false,
    touchDrag: false,
    pullDrag: false,
    rewind: true,
    autoplay: true,
    margin: 0,
    nav: true
  });
});
@import "https://cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.3.4/assets/owl.carousel.min.css";

.owl-carousel {
  transform: rotate(90deg);
  width: 270px;
  margin-top: 100px;
}

.item {
  transform: rotate(-90deg);
}

.owl-carousel .owl-nav {
  display: flex;
  justify-content: space-between;
  position: absolute;
  width: 100%;
  top: calc(50% - 33px);
}

div.owl-carousel .owl-nav .owl-prev,
div.owl-carousel .owl-nav .owl-next {
  font-size: 36px;
  top: unset;
  bottom: 15px;
}
<div class="owl-carousel owl-theme">
  <img class="item" src="https://via.placeholder.com/320x240?text=Slide%200">
  <img class="item" src="https://via.placeholder.com/320x240?text=Slide%201">
  <img class="item" src="https://via.placeholder.com/320x240?text=Slide%202">
  <img class="item" src="https://via.placeholder.com/320x240?text=Slide%203">
  <img class="item" src="https://via.placeholder.com/320x240?text=Slide%204">
  <img class="item" src="https://via.placeholder.com/320x240?text=Slide%205">
  <img class="item" src="https://via.placeholder.com/320x240?text=Slide%206">
  <img class="item" src="https://via.placeholder.com/320x240?text=Slide%207">
</div>

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.3.4/owl.carousel.min.js"></script>

Check this a codepen : https://codepen.io/marcogu00/pen/eLeWMq

Notice that drag must be disabled as it wont work properly

like image 142
Marco Gutierrez Avatar answered Oct 21 '22 16:10

Marco Gutierrez


Here is a CodePen that solves this:

http://codepen.io/dapinitial/pen/xZaRqz

$(".owl-carousel").owlCarousel({
  loop: true,
  autoplay: true,
  items: 1,
  nav: true,
  autoplayHoverPause: true,
  animateOut: 'slideOutUp',
  animateIn: 'slideInUp'
});
like image 38
dapinitial Avatar answered Oct 21 '22 16:10

dapinitial


Regard to the 2.0 beta it's currently not possible to slide vertically. However, the complexity has been significantly reduced by the refactoring and the plugin architecture to make room for more features. This includes in particular an API with which the various animation effects can be broken down into separate animation providers. Thus, a vertical slide would certainly be possible. However, the feature is ambitious and there are some problems to solve. Here is the current roadmap.

like image 4
witrin Avatar answered Oct 21 '22 15:10

witrin


     .item {
        transform: rotate(-90deg);
    }
  .owl-carousel{
         transform: rotate(90deg);
    }
like image 1
Lekhraj Avatar answered Oct 21 '22 16:10

Lekhraj