9

The Owl Carousel slider is not working with RTL. I add rtl: true in the configuration. But it's not loading the slider. The slider space is there and navigation is showing. But only the slider content is not showing. How can I fix this problem?

My code is given below:

<div class="row" id="brand-slider">
    <div class="item">
        <a href="#">
        <img src="{base_url()}assets/upload/brands/{$v.image}" class="img-responsive img-centered" alt="{$v.name}">
        </a>
    </div>
    <div class="item">
        <a href="#">
        <img src="{base_url()}assets/upload/brands/{$v.image}" class="img-responsive img-centered" alt="{$v.name}">
        </a>
    </div>
    <div class="item">
        <a href="#">
        <img src="{base_url()}assets/upload/brands/{$v.image}" class="img-responsive img-centered" alt="{$v.name}">
        </a>
    </div>
    <div class="item">
        <a href="#">
        <img src="{base_url()}assets/upload/brands/{$v.image}" class="img-responsive img-centered" alt="{$v.name}">
        </a>
    </div>
</div>

<script>
    $("#brand-slider").owlCarousel({
        rtl: true,
        loop: true,
        items: 6,
        pagination: false,
        autoPlay: true,
        responsive: true
    });
</script>
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Rayees Pk
  • 2,503
  • 1
  • 23
  • 19

8 Answers8

15

This solution worked for me

Add direction: ltr; to the the .owl-stage-outer class in the owl.carousel.min.css file , as following

.owl-stage-outer{
 position:relative;
 overflow:hidden;
 -webkit-transform:translate3d(0,0,0);
 direction: ltr;
}
Omi
  • 3,954
  • 5
  • 21
  • 41
khaled saleh
  • 470
  • 7
  • 18
5

just add to your CSS

.owl-carousel{
 direction: ltr !important;
}
  • other solutions will work but will make the carousel jumps as you drag it right or left
M.Ali El-Sayed
  • 1,608
  • 20
  • 23
2

For make Owl-Carousel-Version-1 RTL follow these steps :

step-1 : add this codes to your css file

.owl-carousel .owl-item {
   float: right !important;
}

.owl-carousel .owl-wrapper-outer {
   direction: rtl !important;
}  

step-2 : open owl.carousel.js then search transform and replace this lines

"-webkit-transform": "translate3D(" + pixels + "px, 0px, 0px)",
"-moz-transform": "translate3d(" + pixels + "px, 0px, 0px)",
"-o-transform": "translate3d(" + pixels + "px, 0px, 0px)",
"-ms-transform": "translate3d(" + pixels + "px, 0px, 0px)",
"transform": "translate3d(" + pixels + "px, 0px,0px)"

to this (we have to change pixel to -pixel) :

"-webkit-transform": "translate3D(" + -pixels + "px, 0px, 0px)",
"-moz-transform": "translate3d(" + -pixels + "px, 0px, 0px)",
"-o-transform": "translate3d(" + -pixels + "px, 0px, 0px)",
"-ms-transform": "translate3d(" + -pixels + "px, 0px, 0px)",
"transform": "translate3d(" + -pixels + "px, 0px,0px)"

Owl-Carousel-Version-2 already has this feature.

0

Add This Code To Your Css File

.owl-carousel .owl-item,
.owl-wrapper {
    float: right;
}
mohazh
  • 1
  • 2
0

Find this code translate3d("+b+"px,0px,0px) in owl.carousel.min.js and change it to this code translate3d("+(-b)+"px,0px,0px).

mahmood
  • 1
  • 1
0

In the owl.carousel.js file

search for transform you should find something like this

transform: 'translate3d("+b+"px,0px,0px)'

see this "+b+" replace it with "+-b+" it ends up like this

transform: "translate3d(" + -b + "px,0px, 0px)"

Notes this will not work in ltr versions so in my case I am using dynamic application so made 2 files and I called the english version without minus " + b + " and the rtl I added this minus.

it may help someone.

Yousef Altaf
  • 2,631
  • 4
  • 46
  • 71
0

I noticed there is an option for owl slider

$('.owl-carousel').owlCarousel({
    rtl:true,

So you can use that and it will solve the issue.

Kaloyan Stamatov
  • 3,894
  • 1
  • 20
  • 30
0

Upadet your owl carousal version, use owl carousel 2 or update your js and css file.Then use rtl:true,

  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Dec 14 '22 at 15:52