A
A
Alexander Shishkin2017-04-14 16:11:37
JavaScript
Alexander Shishkin, 2017-04-14 16:11:37

How to link navigation to an image?

Good afternoon.
The project uses OwlCarousel 2.х.х.
The question is how to bind the functions of the navigation buttons back and forth to custom images.

I tried to do it like this (I found such a solution on one site, but apparently I’m not using it correctly - it doesn’t work):

$(document).ready(function(){
    $('.owl-carousel').owlCarousel({
        items: 1,
        loop: true,
        autoplay: true,
        smartSpeed: 1000,
        nav: false,
        dots: false,
        }
    );

    $(".next-image").click(function() {
    owl_review.trigger('owl.next');
    });

    $(".prev-image").click(function() {
    owl_review.trigger('owl.prev');
    });
});

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Pushkarev, 2017-04-14
@Touch2me

$(document).ready(function(){
    var owl_review = $('.owl-carousel');

    owl_review .owlCarousel({
        items: 1,
        loop: true,
        autoplay: true,
        smartSpeed: 1000,
        nav: false,
        dots: false,
        }
    );

    $(".next-image").click(function() {
        owl_review.trigger('owl.next');
    });

    $(".prev-image").click(function() {
        owl_review.trigger('owl.prev');
    });
});

D
display: block, 2017-04-14
@qork

$('.prev-image').click(function(){
  $('.owl-carousel').trigger('prev.owl.carousel', [300]);
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question