HTML中添加data-title
<a href="{$link->getImageLink($product->link_rewrite, $imageIds, 'thickbox_default')|escape:'html':'UTF-8'}" data-size="600x700" data-title="{$imageTitle}">
js中修改
linkEl = figureEl.children[0]; // <a> element
// create slide object
item = {
src: linkEl.getAttribute('href'),
w: parseInt(size[0], 10),
h: parseInt(size[1], 10),
title:linkEl.getAttribute('data-title')
};
if(linkEl.children.length > 0) {
// <img> thumbnail element, retrieving thumbnail url
item.msrc = linkEl.children[0].getAttribute('src');
if(figureEl.children.length > 1) {
item.title = figureEl.children[1].innerHTML; // caption (contents of figure)
}
}
可以在HTML中为pswp__caption__center修改样式
效果图: