如何在 window 调整大小时在 owl-carousel 内获得 div 高度?
How to get a div height within owl-carousel on window resize?
我在项目中使用 owl-Carousel,我需要 owlCarousel 中内容 div(topSlidetxt) 的高度 window resize 和 window 加载,我试过了,但还没有得到任何积极的结果。
$('.heroSlide').owlCarousel({
smartSpeed: 1500,
items: 1,
margin:0,
nav:true,
dots:true
});
<div class="heroSlide owl-carousel">
<div class="item">
<div class="row align-items-center">
<div class="col-lg-7">
<div class="topSlideImg">
<img src="assets/images/home-banner-1.jpg" alt="">
</div>
</div>
<div class="col-lg-5">
<div class="topSlidetxt">
<span class="tiTle">South Beach Residences</span>
<h2>Icon to Many, Home to Few</h2>
<a class="linkArrow" href="#">DISCOVER MORE</a>
</div>
</div>
</div>
</div>
</div>
您应该使用 API Events (initialized.owl.carousel, resized.owl.carousel) 的 Owl 轮播 2
用法示例:
$('.heroSlide').owlCarousel({
smartSpeed: 1500,
items: 1,
margin:0,
nav:true,
dots:true,
onInitialized: function () { /* read and use $('.topSlidetxt').height() here */ },
onResized: function () { /* read and use $('.topSlidetxt').height() here */ },
});
我在项目中使用 owl-Carousel,我需要 owlCarousel 中内容 div(topSlidetxt) 的高度 window resize 和 window 加载,我试过了,但还没有得到任何积极的结果。
$('.heroSlide').owlCarousel({
smartSpeed: 1500,
items: 1,
margin:0,
nav:true,
dots:true
});
<div class="heroSlide owl-carousel">
<div class="item">
<div class="row align-items-center">
<div class="col-lg-7">
<div class="topSlideImg">
<img src="assets/images/home-banner-1.jpg" alt="">
</div>
</div>
<div class="col-lg-5">
<div class="topSlidetxt">
<span class="tiTle">South Beach Residences</span>
<h2>Icon to Many, Home to Few</h2>
<a class="linkArrow" href="#">DISCOVER MORE</a>
</div>
</div>
</div>
</div>
</div>
您应该使用 API Events (initialized.owl.carousel, resized.owl.carousel) 的 Owl 轮播 2
用法示例:
$('.heroSlide').owlCarousel({
smartSpeed: 1500,
items: 1,
margin:0,
nav:true,
dots:true,
onInitialized: function () { /* read and use $('.topSlidetxt').height() here */ },
onResized: function () { /* read and use $('.topSlidetxt').height() here */ },
});