jquery - Trigger next page owl carousel 2 -
i'm using owl carousel 2 , have custom nav buttons intend use next/prev item , next/prev page. i'm using following trigger next item:
var slider = $('.owl-carousel'); $('#nextitem').click(function () { slider.trigger('next.owl.carousel'); });
that works fine, need trigger next page (similar how dots work). looks there slideby option can use slide page, won't since need both item , page navigation.
$('#nextpage').click(function () { // go next page });
you trigger clicks on dots:
// go page 3 $('.owl-dot:nth(2)').trigger('click');
to go next page or first if you're on last, can this:
var $dots = $('.owl-dot'); function gotonextcarouselpage() { var $next = $dots.filter('.active').next(); if (!$next.length) $next = $dots.first(); $next.trigger('click'); } $('.something-else').click(function () { gotonextcarouselpage(); });
Comments
Post a Comment