我已经创建了一个图像映射,我想要突出显示鼠标悬停在地图上的区域。为了实现这个,我写了下面的代码。jquery图像映射悬停效果
JS:
<script type="text/javascript">
$(document).ready(function(){
$('#Map area').hover(function(){
alert('alert');
$(this).css('border','1px solid #FF0000');
});
});
</script>
HTML:
<div id="mainmap"><img src="images/map.jpg" alt="" usemap="#Map"/></div>
<map name="Map" id="Map">
<area shape="poly" coords="21,326,203,316,220,141,52,153,48,182,37,193,29,220,27,241,28,255,33,259" href="#" alt="1" />
<area shape="poly" coords="31,405,209,410,225,427,336,427,337,360,200,359,208,317,21,326,15,344,41,360" href="#" alt="11" />
</map>
当我鼠标移到而我认为这是应该提醒,一旦提醒两次的区域。另外.css()函数似乎不能与这个选择器一起使用。
请指导我如何解决