当前项目聚焦在 owl 轮播中时如何显示标题 div?

how to show the caption div when current item is focused in owl carousel?

我需要在当前项目获得焦点时显示标题 div。 我能够显示标题,但是当倒数第二张图片聚焦阳离子时,最后一张图片也显示循环标题。

在第一个循环中,所有标题 div 在图像聚焦时显示,但在第一个循环之后,最后一个图像已经带有标题。 当我保持旋转木马选项 loop:True 当我保持错误时,我导航上一个和下一个然后我不会遇到问题。 供参考:http://jsfiddle.net/ROHIT502/1qdurrLz/95/ Error Image when loop happen 这是 jquery 代码:

$(document).ready(function () {
$('#slider').on('initialized.owl.carousel change.owl.carousel changed.owl.carousel ', function (e) {
if (!e.namespace || e.type != 'initialized' && e.property.name != 'position') return;
var current = e.relatedTarget.current()
var items = $(this).find('.owl-stage').children()
//alert(current);
var add = e.type == 'changed' || e.type == 'initialized'
items.eq(e.relatedTarget.normalize(current)).toggleClass('current', add)
}).owlCarousel({
items: 3,
margin: 10,
itemsDesktop : [1199,3],
itemsDesktopSmall: [979, 3],
autoplay:true,
autoplayTimeout:2000,
autoplayHoverPause: true,
//autoHeight: true,
responsive: true,
center: true,
dots:false,
nav: true,
loop: true
});
})
var elementStyle = document.getElementByClass("caja").hover.style;

elementStyle.position = "relative";

elementStyle.top = "20px";

这会在悬停时将 class caja 向下移动 20 像素 抱歉,我不知道最后一张图片的标题有什么问题我从未使用过 owl 轮播。顺便说一句,你可以自己制作漂亮的旋转木马。