Owl Carousel is not working with direction RTL
Asked Answered
S

9

11

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>
Screech answered 14/8, 2016 at 6:25 Comment(2)
Thank god, that issue waste my long time. Now i found the issue and fixed. Just add style "direction: ltr" to parent Id or class. In my case <div class="row" id="brand-slider" style="direction: ltr;">Screech
I think they need to specify it in their documentation :/Innerdirected
B
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;
}
Bedstraw answered 27/5, 2019 at 10:29 Comment(0)
S
6

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
Spirelet answered 15/8, 2020 at 4:45 Comment(0)
M
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.

Moskow answered 19/7, 2021 at 19:16 Comment(0)
A
0

Add This Code To Your Css File

.owl-carousel .owl-item,
.owl-wrapper {
    float: right;
}
Arlana answered 8/1, 2020 at 9:41 Comment(0)
W
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).

Wist answered 3/6, 2021 at 5:45 Comment(0)
E
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.

Ellison answered 29/12, 2021 at 9:58 Comment(0)
L
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.

Lucas answered 21/6, 2022 at 11:21 Comment(0)
E
0

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

Earpiercing answered 9/12, 2022 at 11:33 Comment(1)
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.Hui
A
0

no one of above answers are correct solution! first, change rtl: false to rtl: true in line 205 of file owl.carousel.js then change rtl:!1 to rtl:1 in file owl.carousel.min.js , that's it the problem will be solved basically

Abessive answered 9/9, 2024 at 14:19 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.