如何在窗口旋转时在猫头鹰轮播中获得div高度?

时间:2019-05-14 10:35:29

标签: jquery owl-carousel

我在项目中使用owl-Carousel,并且在窗口调整大小和窗口负载时需要owlCarousel内的内容div(topSlidetxt)的高度,我已经尝试过此方法,但仍未得到任何积极的结果。

$('.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>

1 个答案:

答案 0 :(得分:1)

您应该使用 Owl Carousel 2

中的API Eventsinitialized.owl.carouselresized.owl.carousel

用法示例:

Array
(
    [1] => Array
        (
            [id] => 50
            [name] => tata
        )

    [2] => Array
        (
            [id] => 31
            [name] => titi
        )

    [4] => Array
        (
            [id] => 12
            [name] => tototo
        )

)

实时示例代码:https://jsfiddle.net/cichy380/sna04L7p/