PhotoSwipe添加caption title
生活随笔
收集整理的這篇文章主要介紹了
PhotoSwipe添加caption title
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
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 urlitem.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修改樣式
效果圖:
總結(jié)
以上是生活随笔為你收集整理的PhotoSwipe添加caption title的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: hibernate的HQL查询语句
- 下一篇: 【PHM】PHM算法与智能分析技术——智