我正在寻找一种在( ) 中显示img
标题和alt
标签的方法。div
.image-caption
到目前为止,这是我的代码:
owl.on('changed.owl.carousel', function(event) {
var comment = $(this).find('img').attr('alt');
var title = $(this).find('img').attr('title');
if(comment) $('#desktop .image-caption').html('<h4>'+title+'</h4><p>'+comment+'</p>');
})
有任何想法吗?谢谢!