csgurl
csgurl

Reputation: 1

Owl carousel 2 using html files instead of img

I am using owl carousel 2 to create a simple sliding carousel. At the minute I am just using images however I would like to be able to use html files instead of . These html files have multiple divs in which images can be loaded into and instead of the whole image sliding away only the would change. Any suggestions as to how I could go about doing this?

Current HTML file:

<div id="carousel" class="owl-carousel">
    <div class="item"><img src="Images/1.jpg" alt="img1" /></div>
    <div class="item"><img src="Images/2.jpg" alt="img2" /></div>
    <div class="item"><img src="Images/3.jpg" alt="img3" /></div>
    <div class="item"><img src="Images/4.jpg" alt="img4" /></div>
</div>

    <script src="Scripts/jquery-1.9.0.js"></script>
    <script src="Scripts/bootstrap.js"></script>
    <script src="Scripts/owl.carousel.js"></script>
    <script src="Scripts/app.js"></script>

Upvotes: 0

Views: 3450

Answers (1)

salam mohd
salam mohd

Reputation: 11

If you are Saying about HTML Elements . Then I have a solution for you. So Let me tell u how to Create a Client Testimonials area with Owl Carousel and Bootstrap.

Make sure you have connected owl.carousel.css, owl.theme.default.min.css and owlcarousel.js.

HTML Code

<section id="clients-reviews" >
        <div class="container">
                    <div class="row">
                        <div class="col-lg-12 text-center">
                            <div id="owl-client-reviews" class="owl-carousel owl-theme">
                                <div class="review">
                                    <p>
                                        " 
    Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat."
                                    </p>
                                    <br>
                                    <h4><span class="name">Salam mohd |</span>  <span class="post">web designer</span> </h4>
                                </div>
                                <div class="review">
                                    <p>
                                        " 
    Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat."
                                    </p>
                                    <br>
                                    <h4><span class="name">Salam mohd |</span>  <span class="post">web designer</span> </h4>
                                </div>
                                <div class="review">
                                    <p>
                                        " 
    Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat."
                                    </p>
                                    <br>
                                    <h4><span class="name">Salam mohd |</span>  <span class="post">web designer</span> </h4>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
</section>

CSS goes like This

#clients-reviews .review p{
    font-family: 'PT Serif Caption', serif;
    color: #ffffff;
    font-size: 18px;
}
#clients-reviews .review span.name{

    color:#fed136;
}
#clients-reviews .review span.post{
        font-family: 'PT Serif Caption', serif;
    font-weight: 300;
    font-size: 14px;
    color: #fed136;
    text-transform: none;
}
#clients-reviews .owl-theme .owl-controls .owl-nav [class*=owl-] {
    background: transparent;
    color: #ffffff;
    bborder: 2px solid  #fed136;
    font-size: 14px;
    padding: 0 10px;
    line-height: 14px;
}

Your JS file will be

 $("#owl-client-reviews").owlCarousel({
        items:1,
        loop:true,
        autoplay:true,
        autoHeight: false,
        autoHeightClass: 'owl-height',
        dots:false,
        nav:true,
        navText:[
            "<i class='fa fa-angle-left fa-2x'></i>",
            "<i class='fa fa-angle-right fa-2x'></i>"
        ]
    });

Note*

I have used Fontawesome Icons for next and pre. If you want increase the items then use the items property.

Thankss :)

Upvotes: 1

Related Questions