Owl carousel next slide presentation

I am using owl carousel 2.0 in a full screen slider. Example here: http://pixelbypixel.comli.com/

It works well, except for the detail: if the user resizes the screen to make it larger, then part of the next slide / image will be displayed for several seconds: enter image description here

Can this be fixed? For example, this problem does not occur with this slider: http://archive.nicinabox.com/superslides/#1 , but in this case I need to use an owl carousel.

This is my markup:

<div class="owl-carousel-container">
    <div class="owl-carousel">
      <div>
        <div class="img-container" style="background:url('img/home-1.jpg') no-repeat center center;-webkit-background-size: cover;-moz-background-size: cover;-o-background-size: cover;background-size: cover;"></div>
      </div>
      <div>
        <div class="img-container" style="background:url('img/home-2.jpg') no-repeat center center;-webkit-background-size: cover;-moz-background-size: cover;-o-background-size: cover;background-size: cover;"></div>
      </div>
      <div>
        <div class="img-container" style="background:url('img/home-3.jpg') no-repeat center center;-webkit-background-size: cover;-moz-background-size: cover;-o-background-size: cover;background-size: cover;"></div>
      </div>
    </div>
</div>

CSS

.owl-carousel-container {
  position: relative;
  width: 100%;
  height: 100% !important;
  background: #00ad9d;
}
.owl-carousel-container .owl-carousel {
  height: 100% !important;
  opacity: 0 !important;
  -webkit-transition: all 0.1s;
  -moz-transition: all 0.1s;
  transition: all 0.1s;
}
.owl-carousel-container .owl-carousel .owl-stage-outer {
  height: 100% !important;
}
.owl-carousel-container .owl-carousel .owl-stage-outer .owl-stage {
  height: 100% !important;
}
.owl-carousel-container .owl-carousel .owl-stage-outer .owl-stage .owl-item {
  height: 100% !important;
}
.owl-carousel-container .owl-carousel .owl-stage-outer .owl-stage .owl-item > div {
  width: 100%;
  height: 100%;
}
.owl-carousel-container .owl-carousel .owl-stage-outer .owl-stage .owl-item .container {
  height: 100%;
  position: relative;
  -webkit-transition: all 0.3s;
  -moz-transition: all 0.3s;
  transition: all 0.3s;
}
.owl-carousel-container .owl-carousel .owl-stage-outer .owl-stage .owl-item .container img {
  width: auto;
  position: absolute;
  right: 15px;
  /*top: 157px;*/
  height: 384px;
  top: 50%;
  margin-top: -177px;
}
.owl-carousel-container .owl-carousel .owl-stage-outer .owl-stage .owl-item div.img-container {
  width: 100%;
  height: 100%;
  position: absolute;
}

JS:

function owlCarousel(){

  var owl = $('.owl-carousel');

  $(".owl-carousel").owlCarousel({
    loop:true,
    nav:false,
    mouseDrag:true,
    touchDrag:false,
    autoplay:true,
    autoplayTimeout:6000,
    autoplaySpeed:600,
    autoplayHoverPause:false,
    onInitialize : function(element){
        owl.children().sort(function(){
            return Math.round(Math.random()) - 0.5;
        }).each(function(){
            $(this).appendTo(owl);
        });
    },
    responsive:{
        0:{
            items:1
        },
        600:{
            items:1
        },
        1000:{
            items:1
        }
    }
  });
}
+4
source share
1 answer

Try adding this option:

responsiveRefreshRate: 10

- 200, , 200 .

:

$('#carousel-1').owlCarousel({
  nav: true,
  dots: true,
  animateIn: 'zoomIn',
  animateOut: 'zoomOut',
  responsiveRefreshRate: 10,
  navText: false,
  responsive: {
    0: {
        items: 1
    },
    600: {
        items: 2
    },
    1000: {
        items: 4
    }
  }
});

, ( , )

+3

Source: https://habr.com/ru/post/1611907/


All Articles