Site Overlay

Owl slider single slide clone error

Owl slider is pretty good slider for normal use in our application. But it has one bug that if you are using owl slider and there is only one slide. Then it throws error about cloning. Then you just have to add little fix like below.

var owl = $('.header-slider');
          owl.owlCarousel({
            nav: owl.children().length > 1,
            navText: ["<i class='fa fa-angle-left'></i>","<i class='fa fa-angle-right'></i>"],
            pagination: false,
            items: 1,
            autoplay: false,
            autoplaySpeed: 500,
            loop: owl.children().length > 1
          });

Highlighted line will solve your issue and be smiling.

Leave a Reply

Your email address will not be published. Required fields are marked *

Copyright © 2022 Dip Codes. All Rights Reserved.