如何显示alt和标题

问题描述 投票:0回答:4

我需要在我的 fotorama 轮播中显示图片的标题和 alt。 我在 中获取了 alt 和标题,但是当我的页面加载时,fotoroma 隐藏(或删除)了 alt 和标题。我不知道显示我的属性的选项在哪里。

有人知道这个功能或选项在哪里吗?

谢谢

弗林克

fotorama
4个回答
2
投票

此问题的简单解决方案。

为了显示图像中的 Alt 和标题,请使用 DIV 中的图像。

用途:

<div><img  src="http://www.example.com/image.png" alt="My Alt" title="My Title"/></div>

而不是:

<img  src="http://www.example.com/image.png" alt="My Alt" title="My Title"/>

1
投票

Fotorama 3.0.8 使用

alt
属性:

<div class="fotorama">
    <img src="1.jpg" alt="One">
    <img src="2.jpg" alt="Two">
</div>

启用字幕:

<script>
fotoramaDefaults = {
    caption: 'overlay' // or 'simple' or 'none'
}
</script>

Fotorama 4.4.8 使用

data-caption
属性:

<div class="fotorama">
    <img src="1.jpg" data-caption="One">
    <img src="2.jpg" data-caption="Two">
</div>

启用字幕:

<script>
fotoramaDefaults = {
    captions: true
}
</script>

1
投票

要使用标题和 alt,请使用这个修补过的 fotorama.js

/*! * Fotorama 4.6.4 修补替代标题 | http://fotorama.io/license/ * https://github.com/artpolikarpov/Fotorama + 补丁 */

更换这个

f=n(c.width||a.attr("width")),g=n(c.height||a.attr("height"));d.extend(c,{width:f,height:g,thumbratio:S

f=n(c.width||a.attr("width")),g=n(c.height||a.attr("height")),x=a.attr("alt"),y=a.attr("title");;d.extend(c,{width:f,height:g,alt:x,title:y,thumbratio:S

这个

t.on("load",q).on("error",o)),m.state="",s.src=w}}})}function Qb

t.on("load",q).on("error",o)),m.state="",s.alt=m.data.hasOwnProperty('alt')?m.data.alt:'',s.title=m.data.hasOwnProperty('title')?m.data.title:'',s.src=w}}})}function Qb

0
投票

para los que tienen el Mismo Problema me pueden hablar al Whatsapp para pasarles el js y lo Implementen de gratis jajaj pero si me quieren donar 1 dolar o lo que puedan no hay Problema jejeje

有同样问题的朋友,可以WhatsApp给我发js给你,免费实现哈哈,但是如果你想捐1块钱什么的,没问题嘿嘿嘿

© www.soinside.com 2019 - 2024. All rights reserved.