繁体   English   中英

如何添加标题和链接到图片库模式?

[英]how to add caption and link to image gallery modal?

我正在尝试自定义 html 模板。 这是

https://html5up.net/ethereal

它有一个带模态的画廊。 我想在该模式中添加一个简单的链接和一些文本。 但我无法这样做。

谁能帮帮我吗。

谢谢你

请按照以下步骤操作:每个图库图像添加标题和链接数据,如下所示:

<a href="images/gallery/fulls/01.jpg" class="image filtered span-3" data-position="bottom" data-url="addlink" data-caption="addcaption"><img src="images/gallery/thumbs/01.jpg" alt=""></a>

在 main.js 中找到这一行

$modalImg = $modal.find('img'),
href = $a.attr('href');

在这下面添加这些行:

var caption = $a.data('caption');
var capurl = $a.data('url');
$modal.find('.caption').remove();

然后找到这一行

$modalImg.attr('src', href);

并在此之后添加(标题和链接)

if(caption!=undefined){
$modalImg.before('<div class="caption"><a href="'+capurl+'">'+caption+'</a></div>');
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM