我有一个像这样的VML地图:
(所用结构的样本)
<div class="map" jQuery1351170963063="74">
<div class="usmap" jQuery1351170963063="75">
<group class="g vg" style="visibility: visible;" jQuery1351170258860="79" height="256px" width="434px" coordsize="21600,21600">
<shape class="vmap" id="Maryland_md" jQuery1351170258860="105"/>
<shape class="vmap" id="Delaware_de" jQuery1351170258860="104"/>
<shape class="vmap" id="Alaska_ak" jQuery1351170258860="94">
</group>
</div>
</div>
在IE7&amp; IE8,有时鼠标中心事件在将鼠标悬停在形状节点上时不会触发。
JS代码:
var $canvas = $(".usmap", $this);
var $canvasParent = $canvas.parent();
var mouseenterEvent = "mouseenter";
var mouseleaveEvent = "mouseleave";
$(".g", $canvas).delegate(element, mouseenterEvent + " " + mouseleaveEvent, onMouseEnterVMLShape)
.add($canvas).add($keys).add($canvasParent).mouseleave(onMouseLeaveVMLShape);