Im using Owl Carousel 2.0.0-beta.2.4 and in one slide I have a HTML5 video. What I want to do is when I change slide I want the video to be paused or stopped if pause is not possible. The slide can be changed by drag, touch, next and prev buttons and by keyboard arrows.
My script looks like this right now:
$('.owl-carousel').owlCarousel({
items: 1,
animateOut: 'fadeOut',
animateIn: 'fadeIn',
URLhashListener: true,
startPosition: 'URLHash',
nav: true,
autoHeight : true,
video:true,
});
var owl = $('.owl-carousel').data('owlCarousel');
$(document.documentElement).keyup(function(event) {
if (event.keyCode == 37) {
owl.prev();
} else if (event.keyCode == 39) {
owl.next();
}
});
I have heard about onMove or callback functions but I don't quite understand them.
I solved it with this code:
So final code for my owl-carousel is:
Check out the doc: http://www.owlcarousel.owlgraphic.com/docs/api-events.html