gpt4 book ai didi

javascript - 中心对齐 Owl Carousel 元素

转载 作者:行者123 更新时间:2023-12-02 02:54:58 25 4
gpt4 key购买 nike

如何在屏幕中间对齐这个猫头鹰元素?

试过:center: true

请查看全页 View :

var owl = $('.video-thumb').owlCarousel({
items: 7,
autoplay: false,
loop: false,
nav: true,
dots: false,
margin: 30,
center: true,
responsive: {
0: {
items: 1
},
640: {
items: 2
},
768: {
items: 3
},
992: {
items: 4
},
1200: {
items: 5
},
1600: {
items: 7
}
}
});
<link href="https://owlcarousel2.github.io/OwlCarousel2/assets/owlcarousel/assets/owl.carousel.min.css" rel="stylesheet"/>
<link href="https://owlcarousel2.github.io/OwlCarousel2/assets/owlcarousel/assets/owl.theme.default.min.css" rel="stylesheet"/>
<script src="https://owlcarousel2.github.io/OwlCarousel2/assets/vendors/jquery.min.js"></script>
<script src="https://owlcarousel2.github.io/OwlCarousel2/assets/owlcarousel/owl.carousel.js"></script>
<div class="video-thumb owl-carousel owl-theme">
<div class="thumb-item">
<a href="#"><img src="https://via.placeholder.com/150" alt="eMAM Cloud" /></a>
</div>
<div class="thumb-item">
<a href="#"><img src="https://via.placeholder.com/150" alt="eMAM Cloud" /></a>
</div>
</div>

它可能包含任意数量的元素。

JSFiddle

最佳答案

将此添加到您的 CSS 中:

.owl-carousel{
display: flex !important; // to override display:bloc i added !important
flex-direction: row;
justify-content: center; // to center you carousel
}

JSFiddle:https://jsfiddle.net/2z1qadv3/

关于javascript - 中心对齐 Owl Carousel 元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61319753/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com