owl carousel无法使用bootstrap RTL 3(阿拉伯语)

时间:2015-06-06 08:33:33

标签: javascript jquery html twitter-bootstrap owl-carousel

我在项目中添加了owl carouselbootstrap 3 arabic就像这样

HTML

<div class="container">
    <div class="row">
        <div class="col-sm-6">
            <div class="owl-carousel">
                <img class="owl-lazy" data-src="http://placehold.it/350x250&text=1" data-src-retina="http://placehold.it/350x250&text=1-retina">
                <img class="owl-lazy" data-src="http://placehold.it/350x250&text=2" data-src-retina="http://placehold.it/350x250&text=2-retina">
                <!-- other images -->
            </div>
        </div>
    </div>
</div>

JS

$('.owl-carousel').owlCarousel({
    items: 4,
    lazyLoad: true,
    loop: true,
    margin: 10
});

但猫头鹰旋转木马不适用于阿拉伯语引导程序,也不显示任何图像 我该如何解决这个问题?

fiddle DEMO

5 个答案:

答案 0 :(得分:2)

添加选项 - rtl:true

http://www.owlcarousel.owlgraphic.com/demos/rtl.html

http://jsfiddle.net/soledar10/6ef5p1u1/

$('.owl-carousel').owlCarousel({
    items: 4,
    lazyLoad: true,
    loop: true,
    margin: 10,
    rtl:true
});
<link href="http://www.owlcarousel.owlgraphic.com/assets/owlcarousel/assets/owl.carousel.min.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="http://www.owlcarousel.owlgraphic.com/assets/owlcarousel/owl.carousel.js"></script>
<link href="http://www.owlcarousel.owlgraphic.com/assets/owlcarousel/assets/owl.theme.default.min.css" rel="stylesheet"/>
<link href="http://servu.besaba.com/bootstrap-rtl.css" rel="stylesheet"/>
<div class="container">
    <div class="row">
        <div class="col-sm-6">
            <div class="owl-carousel">
                <img class="owl-lazy" data-src="http://placehold.it/350x250&text=1" data-src-retina="http://placehold.it/350x250&text=1-retina" alt="">
                <img class="owl-lazy" data-src="http://placehold.it/350x250&text=2" data-src-retina="http://placehold.it/350x250&text=2-retina" alt="">
                <img class="owl-lazy" data-src="http://placehold.it/350x250&text=3" alt="">
                <img class="owl-lazy" data-src="http://placehold.it/350x250&text=4" alt="">
                <img class="owl-lazy" data-src="http://placehold.it/350x250&text=5" alt="">
                <img class="owl-lazy" data-src="http://placehold.it/350x250&text=6" alt="">
                <img class="owl-lazy" data-src="http://placehold.it/350x250&text=7" alt="">
                <img class="owl-lazy" data-src="http://placehold.it/350x250&text=8" alt="">
                <img class="owl-lazy" data-src="http://placehold.it/350x250&text=9" alt="">
                <img class="owl-lazy" data-src="http://placehold.it/350x250&text=10" alt="">
                <img class="owl-lazy" data-src="http://placehold.it/350x250&text=11" alt="">
            </div>
        </div>
    </div>
</div>

答案 1 :(得分:1)

亲爱的朋友,您可以使用以下代码代替&#34; owl.carousel.css&#34;直到问题得到解决。

&#13;
&#13;
/* 
 * 	Core Owl Carousel CSS File
 *	v1.3.3
 */

/* clearfix */
.owl-carousel .owl-wrapper:after {
	content: ".";
	display: block;
	clear: both;
	visibility: hidden;
	line-height: 0;
	height: 0;
}
/* display none until init */
.owl-carousel{
	display: none;
	position: relative;
	width: 100%;
	-ms-touch-action: pan-y;
}
.owl-carousel .owl-wrapper{
	display: none;
	position: relative;
	-webkit-transform: translate3d(0px, 0px, 0px);
	float: left;
}
.owl-carousel .owl-wrapper-outer{
	float: left;
	overflow: hidden;
	position: relative;
	width: 200%;
}
.owl-carousel .owl-wrapper-outer.autoHeight{
	-webkit-transition: height 500ms ease-in-out;
	-moz-transition: height 500ms ease-in-out;
	-ms-transition: height 500ms ease-in-out;
	-o-transition: height 500ms ease-in-out;
	transition: height 500ms ease-in-out;
}
	
.owl-carousel .owl-item{
	float: left;
}
.owl-controls .owl-page,
.owl-controls .owl-buttons div{
	cursor: pointer;
}
.owl-controls {
	-webkit-user-select: none;
	-khtml-user-select: none;
	-moz-user-select: none;
	-ms-user-select: none;
	user-select: none;
	-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}

/* mouse grab icon */
.grabbing { 
    cursor:url(grabbing.png) 8 8, move;
}

/* fix */
.owl-carousel  .owl-wrapper,
.owl-carousel  .owl-item{
	-webkit-backface-visibility: hidden;
	-moz-backface-visibility:    hidden;
	-ms-backface-visibility:     hidden;
  -webkit-transform: translate3d(0,0,0);
  -moz-transform: translate3d(0,0,0);
  -ms-transform: translate3d(0,0,0);
}
&#13;
&#13;
&#13;

答案 2 :(得分:0)

或者您可以设置 autoPlay:true

要制作图片幻灯片,您可以使用许多选项(插件):

  • Bootstrap Carousel
  • 使用Wowslider
  • Flexslider
  • Coinslider

Detailed Technology Center

答案 3 :(得分:0)

这解决了这个问题,在dir上应用div属性,其中包含您的javascript可以使用的元素

<强> HTML

<div class="col-sm-6" dir="ltr">
    <div class="owl-carousel">
        <!-- your html -->
    </div>
</div>

并且不需要修改javascript的代码

Github issue

答案 4 :(得分:0)

您可以在owl.carousel.css上替换这些样式

.owl-carousel .owl-wrapper{
    display: none;
    position: relative;
    -webkit-transform: translate3d(0px, 0px, 0px);
    float: left;
}
.owl-carousel .owl-item{
    float: left;
}