我知道你在2012年發佈了這個,但這裏是你的問題的答案。我必須爲WCAG合規工作做好準備。我實際上使用ASP.NET,所以<%= Name%>是佔位符。簡單地將此添加到您使用Galleria工具的頁面。我在結束標籤之前寫了腳本。最大的問題是setTimeout,因爲你必須給燈箱加載時間。
Galleria.ready(function() {
this.bind('image', function (e) {
// UNCOMMIT FOR TESTING // console.log(this); // the gallery scope
$('.galleria-image').find('img').attr('alt', '<%=Name%>');
});
this.bind('thumbnail', function (e) {
// add alt to thumbnails image
e.thumbTarget.alt = e.galleriaData.original.alt + " ThumbNail(s)";
});
$('.galleria-image').mouseup(function() {
setTimeout(function() {
$('div.galleria-lightbox-image').children().children().attr('alt', '<%=Name%>');
}, 5000);
});
$('.galleria-lightbox-prevholder').click(function() {
$('div.galleria-lightbox-image').children().children().attr('alt', '<%=Name%>');
});
$('.galleria-lightbox-nextholder').click(function() {
$('div.galleria-lightbox-image').children().children().attr('alt', '<%=Name%>');
});
});
插件的文件應該在/ wp-content/plugins中。 –