试图从灯箱库中删除烦人的替代文字 [英] Trying to remove pesky alt text from lightbox gallery

查看:96
本文介绍了试图从灯箱库中删除烦人的替代文字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 www.unlicensedeyesurgery.com 使用着名的灯箱代码在我的画廊中画廊。它有一个问题:灯箱代码使用锚标记的 rel 属性在弹出的窗口中显示图像的描述。但是,这会以某种方式覆盖图像的 alt 属性,并在鼠标工具提示中显示丑陋的HTML代码描述。有没有办法完全停用工具提示 - 也许使用JS?

I have a gallery of my paintings at www.unlicensedeyesurgery.com which uses the famous Lightbox code. There is one problem with it: the Lightbox code uses the rel attribute of the anchor tag to display the description of the image in the pop-up "window." However, this somehow overrides the images' alt property and shows the ugly, HTML-code description in the mouse tooltip. Is there a way to disable to tooltip altogether—perhaps using JS?

代码示例:

Code Example:

<a href="#" rel="<em>lightbox html<span>styled</span> text in here<em>">
  <img src="photo.jpg" alt="this is overwritten" />
</a>


推荐答案

您的标题被< ;一个标题=....> 你在这里图像设置它的标题alt内容

Your title overrided by <a title="...."> as you have here image set it's title to alt content

你可以做到这一点javascript:

you can do it with javascript:

window.onload=function() {
 var images=document.getElementsByTagName('img');
 for (var i in images) {
   images[i].title=images[i].alt ;delete(images[i].alt);
 }
};

这篇关于试图从灯箱库中删除烦人的替代文字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆