每次移动后如何显示(在 div 中)图像 alt?我试试这个,但它不起作用(我总是得到第一个 alt)
<div id="owlSlider" class="owl-carousel owl-theme">
<div class="item"><img src="lg/img_1.jpg" alt="Image 1" class="img-responsive"></div>
<div class="item"><img src="lg/img_2.jpg" alt="Image 2" class="img-responsive"></div>
<div class="item"><img src="lg/img_3.jpg" alt="Image 3" class="img-responsive"></div>
</div>
<div><p id="legend" style="font-size:1.4em"> </p></div>
$("#owlSlider").owlCarousel({
navigation : false,
pagination: true,
slideSpeed : 300,
paginationSpeed : 400,
singleItem:true,
autoPlay:true,
transitionStyle : 'fade',
rewindNav: true,
afterMove : function (elem) {
var leg = elem.find('img').attr('alt');
//console.log(elem);
$('#legend').html(leg);
}
});
谢谢你的帮助...