How to use owl carousel vertically?

前端 未结 4 1600
清歌不尽
清歌不尽 2020-12-10 05:07

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 horiz

4条回答
  •  独厮守ぢ
    2020-12-10 05:33

    Works only with square images or square elements Follows example with mouse enabled https://codepen.io/luis7lobo9b/pen/zYrEqKj

    
    
    /* CSS */ .wrapper{ height: 300px; width: 300px; } .owl-carousel-vertical{ transform: rotate3d(0, 0, 1, 90deg); } .owl-carousel-vertical .item{ transform: rotate3d(0, 0, 1, -90deg); } // JS $(function(){ $('.owl-carousel').owlCarousel({ items: 1, loop: false, nav: false, margin: 0 }); // this code below enables drag and drop vertically. Unfortunately I was unable to disable horizontal drag and drop so it will remain active, but we already have something now =D $('.owl-carousel').data('owl.carousel').difference = function(first, second) { return { x: first.x - second.x + (first.y - second.y), y: first.y - second.y }; }; });

提交回复
热议问题