简体   繁体   English

HTML-Fancybox-在图片缩略图下方添加文本

[英]HTML - Fancybox - Adding text below image thumbnail

I am using an HTML code for simple image gallery on my website from this demo: http://fancyapps.com/fancybox/demo/ Is there an easy way to add text below each thumbnail which would be different from the image title (which is displaying after clicking on a thumbnail)? 我正在此演示中的网站上使用HTML代码编写简单的图片库: http : //fancyapps.com/fancybox/demo/是否有一种简单的方法可以在每个缩略图下方添加与图片标题不同的文本(单击缩略图后显示)?

Thank you very much. 非常感谢你。

EDIT: Thanks for your help, but it was't quite what I asked. 编辑:感谢您的帮助,但这不是我问的。 Anyway, my friend has solved it. 无论如何,我的朋友已经解决了。 Both image link and description must be included next to each other in one parent element, like this: 图像链接和描述都必须在一个父元素中彼此相邻包含,如下所示:

<div>
    <a ... ><img src="image link" alt="First picture" /></a>
    <p>Description</p>
</div>

Then the width of the div is set to the width of the image thumbnail, causing the description to "drop" down below the thumbnail. 然后,将div的宽度设置为图像缩略图的宽度,从而使描述“下降”到缩略图下方。

Have you try using inline option? 您尝试使用内联选项吗? As it is quite similar to what you want. 因为它与您想要的非常相似。

Link Button 链接按钮

<a class="fancybox" href="#inline1" title="Lorem ipsum dolor sit amet">Inline</a>

Inline Html 内联HTML

<div id="inline1" style="width:400px;display: none;">
  <p>Your Main image could be here</p>
  <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam quis mi eu elit tempor facilisis id et neque.</p>
</div>

You can wrap the text inside the <p> tag and add some CSS to fix the layout 您可以将文本包装在<p>标记内,并添加一些CSS以修复布局

<a class="fancybox" href="1_b.jpg" data-fancybox-group="gallery" title="Lorem ipsum dolor sit amet">
    <img src="1_s.jpg" alt="">
    <p>some text</p>
</a>

CSS: CSS:

.fancybox {
    display: inline-block;
    vertical-align: top;
}
.fancybox img {
    display: block;
}

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

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