如何防止将鼠标悬停在图像上时出现替代文本?

发布于 2024-10-21 06:54:00 字数 272 浏览 6 评论 0原文

我尝试添加 title="" 但当我将鼠标悬停在 FF 和 Safari 中的照片上时,我的替代文本仍然出现...

我还可以尝试其他方法吗?

这是我的示例页面:

http://ianmartinphotography.com/test-site/wedding-01/< /a>

谢谢!

I've tried adding title="" but my alt text still appears when I hover over the photos in FF and Safari...

Anything else I can try?

Here's my example page:

http://ianmartinphotography.com/test-site/wedding-01/

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

¢好甜 2024-10-28 06:54:00

您必须影响 ALT 标签,而不是标题。

您的图片标签如下所示:

<img src="photos/half-moon-bay-wedding/bride-ready-for-wedding.jpg" title="" alt="Bride ready for wedding in black and white." style="position: absolute; display: block; z-index: 0; height: 467px; width: 730px; left: 0px; top: 0px; visibility: visible; zoom: 1; opacity: 1; " height="467" width="730">

这就是给您带来麻烦的原因:

title="" alt="新娘准备好参加黑白婚礼。"

或者也许会说;这就是让您获得完全预期结果的原因!

You have to affect the ALT tag, not title.

Your image tag looks like this:

<img src="photos/half-moon-bay-wedding/bride-ready-for-wedding.jpg" title="" alt="Bride ready for wedding in black and white." style="position: absolute; display: block; z-index: 0; height: 467px; width: 730px; left: 0px; top: 0px; visibility: visible; zoom: 1; opacity: 1; " height="467" width="730">

This is what cause you trouble:

title="" alt="Bride ready for wedding in black and white."

Or perhaps saying; That's what cause you an fully expected result!

心欲静而疯不止 2024-10-28 06:54:00

导致您出现问题的不是 alt 属性。其内容如下:

<a href="#slide-0" title="Bride ready for wedding in black and white."><img src="photos/thumbnails/bride-ready-for-wedding.jpg" title="" alt="" style="display: none; position: absolute; z-index: 1; "><img src="photos/half-moon-bay-wedding/bride-ready-for-wedding.jpg" title="" alt="Bride ready for wedding in black and white." style="position: absolute; display: block; z-index: 2; height: 467px; width: 730px; left: 0px; top: 0px; visibility: visible; zoom: 1; opacity: 1; " height="467" width="730"></a>

图像位于锚点内,链接具有显示的 title 属性。

It is not the alt attribute what causes your problem. It is the following:

<a href="#slide-0" title="Bride ready for wedding in black and white."><img src="photos/thumbnails/bride-ready-for-wedding.jpg" title="" alt="" style="display: none; position: absolute; z-index: 1; "><img src="photos/half-moon-bay-wedding/bride-ready-for-wedding.jpg" title="" alt="Bride ready for wedding in black and white." style="position: absolute; display: block; z-index: 2; height: 467px; width: 730px; left: 0px; top: 0px; visibility: visible; zoom: 1; opacity: 1; " height="467" width="730"></a>

Images are inside anchors, and the links get a title attribute which gets shown.

夜夜流光相皎洁 2024-10-28 06:54:00

假设它与您用于“显示框”的 jQuery 有关,也许可以阅读自述文件或其他内容。
但是,我在您的代码中注意到了这一点

<img id="slide-0" src="photos/half-moon-bay-wedding/bride-ready-for-wedding.jpg" alt="Bride ready for wedding in black and white." title=" "  /></a> 

为什么您有 ?没有需要关闭的超链接。

更新
查看您的代码后,我发现了这一行

var caption = $pick(img.get('alt'), img.get('title'), '');

(位于 http://ianmartinphotography .com/test-site/wedding-01/js/slideshow.js
尝试删除 (img.get('alt'), 看看是否有帮助

I'm assuming it's related to the jQuery your using for the "display box", perhaps read over the readme or something.
However, I noticed this in your code

<img id="slide-0" src="photos/half-moon-bay-wedding/bride-ready-for-wedding.jpg" alt="Bride ready for wedding in black and white." title=" "  /></a> 

Why do you have </a>? There is no hyperlink that needs to be closed.

Update
After looking over your code I found this line

var caption = $pick(img.get('alt'), img.get('title'), '');

(located in http://ianmartinphotography.com/test-site/wedding-01/js/slideshow.js)
Try removing (img.get('alt'), see if that helps

红尘作伴 2024-10-28 06:54:00

好的!我的错 - 我正在使用 Mootools Slideshow2 http://code.google.com/p/slideshow/
该节目默认打开标题,它将替代文本转换为标题。我只是将 Slideshow.js 中的标题从“true”更改为“false”,问题就解决了。我觉得有点傻,我应该马上想到这一点。感谢大家的关注!

Okay! My bad--I'm using Mootools Slideshow2 http://code.google.com/p/slideshow/
The show defaults to having titles on, it converts alt text into titles. I simply changed titles from "true" to "false" in slideshow.js and the problem is solved. I feel a bit silly, I should have thought of that right away. Thanks for your attention everyone!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文