【发布时间】:2012-10-03 04:02:35
【问题描述】:
我有一个 自定义工具提示 功能(在 jQuery 中),它在所有 [主要] 浏览器(甚至在 IE8 中)都很好用除了IE7。
网站的文档类型是较新的 html 5 doctype (<!DOCTYPE html>)。
有 5 个链接/图片。 IE7 正确显示第一个工具提示(减去一些小的布局问题 - 但可以修复),但在其他链接(图像)上,它会恢复为其余的原始浏览器工具提示。
$('#port-window a').hover(function() {
var tip = $(this).attr('title');
$(this).attr('title','');
$(this).append("<div id='tooltip'>"+ tip +"</div>");
$("#tooltip")
.css("position","relative")
.css("z-index","999")
.fadeIn("slow");
}, function() {
$(this).attr('title',$('#tooltip').html());
$(this).children('div#tooltip').remove();
});
标题的HTML是这样的:
<ul class="portfolio">
<li>
<div id="port-window">
<a title="This is the title" href="[blogurl]/work/web-design-dev/website/">
<span class="window"></span>
<span class="gradient"></span>
<img src="[blogurl]/portfolio-images/thumbs/image.jpg" alt="alt tag info" title="img title attr - not used" />
</a>
</div>
</li>
</ul>
谁能解释一下如何解决这个问题?
【问题讨论】:
-
你在title属性中使用了什么?是否发生任何错误?
-
你能在 jsfiddle.net 中提供一个工作小提琴吗?
-
大家好。上面添加了html。我将在 jsFiddle 上工作并很快提供一个链接。不要介意href标签-这些标签严格用于wordpress
-
jsfiddle.net/designer84/Xg7ru。这会给你一个大致的想法......
-
我不确定这是否有很大帮助,但是当鼠标悬停在第二张和第三张图像上时,IE7 不会触发 mouseover 事件。试试 console.log('Event !') 鼠标悬停 & 你会发现我在说什么。
标签: jquery internet-explorer-7