猫头鹰旋转木马,导航中心

我使用owl carousel插件,找不到如何让导航垂直对齐中心,选项autoHeight。

我尝试过如下,但它只能达到最后的高度。

$(this_gallery).owlCarousel({ singleItem: true, autoHeight : true, navigation:true, // autoPlay : 2000, stopOnHover : true, afterAction: function() { var center_height = $(this_gallery).find('.owl-wrapper-outer').height(); console.log(center_height); // $(this_gallery).find('.owl-buttons').css('top', center_height); } }); 

而不是像素中的top position给出它的percentage如下:

 .owl-theme .owl-controls .owl-buttons .owl-prev { left: -45px; top: 45%; } 

可能有点晚了,但这对我很有用,可能会帮助别人:

 #photos .owl-nav{ position: absolute; top: 45%; width: 100%; } #photos .owl-prev{ float:left; } #photos .owl-next{ float:right; } 

更改prev和next按钮的css

 .owl-theme .owl-controls .owl-buttons .owl-next,.owl-theme .owl-controls .owl-buttons .owl-prev { top:40%; }