jquery悬停在图像映射ie7 / ie8上的区域

时间:2012-09-17 11:08:33

标签: jquery hover area

我有一个imagemap并使用以下

 $('area').hover(function(e) { 

问题是ie7和8没有检测到区域标签的悬停事件。有解决方法吗?

1 个答案:

答案 0 :(得分:0)

我创建了一个简单的演示,试图重现您的问题,但似乎工作正常。我使用IE9但通过集成的开发人员工具更改了浏览器模式来测试IE7和IE8。

<强> HTML

<img src="http://placekitten.com/g/400/400" width="400" height="400" alt="Kitten" usemap="#areamap" />

<map name="areamap" id="areamap">
  <area shape="rect" coords="100,100,300,300" href="#top" alt="Top" id="area1" />
</map>​

<强>的Javascript

$('area').hover(
    function(event) { console.log(event.type, this.id); },
    function(event) { console.log(event.type, this.id); }
);

欢迎您在http://jsfiddle.net/Xcm46/

自行试用