L
L
ligisayan2020-03-03 10:58:21
JavaScript
ligisayan, 2020-03-03 10:58:21

AutoWidth setting in owl carousel 2 does not work on iphone - how to fix it?

Hello!
There is an owl carousel 2 with these settings

$(document).ready(function () {
   $(".marathon").owlCarousel({
    margin:15,
    //autoWidth: true,
    lazyLoad:true,
    pagination: false,
    responsiveRefreshRate: 200,
    animateOut: "fadeOut",
    responsive:{
       0:{
           items:2,
           nav:false
         },
       541:{
           items:3,
           nav:true,
           autoWidth: true  
         }
    }
   });
});


On all devices with autoWidth: true , it works well, except for the iphone , where pictures do not have time to load so that the width works correctly and, as a result, at least the carousel works, but the fonts are huge. Therefore, I left autoWidth only for the desktop for now.

How can this be fixed so that it works everywhere?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
L
ligisayan, 2020-03-03
@ligisayan

In my case, setting styles worked

.owl-stage {
    display: -webkit-box;
    display: -moz-box;
    display: -ms-box;
    display: box;
}

A
Alexander Cheremkhin, 2020-03-03
@Che603000

iphone, where pictures do not have time to load so that the width works correctly

Try loading pictures programmatically before starting the carousel. After processing the img.load event for all images, start the carousel. Maybe this will work

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question