0
我有一個畫廊,我放了一個燈箱,但我不知道如何在燈箱中顯示圖片的標題或描述。現在,「標題」僅顯示在Lightbox中的「mouseenter」上。我想與圖片下的文字排成一行。我該怎麼辦?如何向燈箱添加標題或描述?
HTML:
<a href="../img/animals/1_korytnacka.jpg" title="Turtle - 50 x 50 x 3,5 cm">
<img src="../img/animals/1_thumb.jpg" alt="Korytnacka">
</a>
JS:
var overlay = $('<div>', {
id: 'overlay'
}).appendTo('body');
overlay.hide();
$('.gallery-set a').on('click', function(e) {
e.preventDefault();
overlay.empty().show();
$('<img>', {
src: $(this).attr('href'),
alt: $(this).attr('alt'),
title: $(this).attr('title')
}).appendTo(overlay);
});
overlay.on('click', function() {
$(this).hide();
});
$(document).on('keydown', function(e) {
if(e.which == 27) {
overlay.hide();
}
});
您可以隨時添加一個'paragraph'標籤'img'和風格之下。 – Hewlett
想要在點擊圖片或之前顯示標題嗎? –
點擊後。 – Jayna