一页上有多个猫头鹰轮播,键盘右箭头键可同时更改所有轮播的幻灯片。我需要它来更新可见的一个轮播
var projecten = $(".owl-carousel");
projecten.each(function() {
var $this = $(this);
$this.owlCarousel({
responsiveRefreshRate: 1,
loop: true,
margin: 10,
responsiveClass: true,
items: 1,
nav: true,
dots: false,
autoplay: false,
autoplayTimeout: 6000,
smartSpeed: 750,
mouseDrag:'true',
pullDrag:'true',
animateIn: 'fadeIn',
animateOut: 'fadeOut'
});
$(document.documentElement).keyup(function (event) {
var owl = $(".owl-carousel");
// handle cursor keys
if (event.keyCode == 37) {
// go left
owl.trigger('prev.owl');
} else if (event.keyCode == 39) {
// go right
owl.trigger('next.owl');
}
});