Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Owl Carousel 2 Navigation In Slide

I am using the Owl Carousel 2 jquery plugin, and am trying to have the navigation buttons contained within the slides. My html is very simple:

<div class="owl-carousel">    
<div>
  <p>Slide 1 Lorem ipsum dolor sit amet, consectetur adipisicing elit. Placeat quisquam rem assumenda, ullam, beatae earum animi magnam! Reiciendis, laboriosam, itaque.</p>

  <div class="customNavigation">
    <a class="prev">Previous</a>
    <a class="next">Next</a>
  </div>

</div>

<div>
  <p>Slide 2 Lorem ipsum dolor sit amet, consectetur adipisicing elit. Placeat quisquam rem assumenda, ullam, beatae earum animi magnam! Reiciendis, laboriosam, itaque.</p>

  <div class="customNavigation">
    <a class="prev">Previous</a>
    <a class="next">Next</a>
  </div>

</div>

<div>
  <p>Slide 3 Lorem ipsum dolor sit amet, consectetur adipisicing elit. Placeat quisquam rem assumenda, ullam, beatae earum animi magnam! Reiciendis, laboriosam, itaque.</p>

  <div class="customNavigation">
    <a class="prev">Previous</a>
    <a class="next">Next</a>
  </div>

</div>

And then I am calling the plugin like so:

$(document).ready(function(){    
    $('.owl-carousel').owlCarousel({
        loop:true,
        items: 1,
    })      
});

Now I just need to get the links to work with the plugin! Any help greatly appreciated

like image 222
Mike Harrison Avatar asked Feb 19 '15 11:02

Mike Harrison


1 Answers

Hope this might help you mate.

$('.owl-carousel').owlCarousel({
    loop: true,
    items: 1,
});
owl = $('.owl-carousel').owlCarousel();
$(".prev").click(function () {
    owl.trigger('prev.owl.carousel');
});

$(".next").click(function () {
    owl.trigger('next.owl.carousel');
});

Fiddle here

like image 186
Outlooker Avatar answered Oct 10 '22 03:10

Outlooker