我很难让ImageMapster高亮显示我的地图区域。在阅读文档时,我的印象是,通过简单地使用$('img').mapster();,我应该能够看到我的地图区域通过鼠标突出显示。
我不会看到这种事发生的。我可以选择的区域,但他们不鼠标通过。
但是,如果我将onMouseOver和onMouseOut属性放在映射区域,那么就可以使突出显示函数工作起来。
这是我问题的关键。当我试图将ImageMapster与一些动态C#代码集成时,我无法将onMouseOver和onMouseOut属性放在地图区域。WebControls.CircleHotSpot的C#对象似乎不支持自定义属性。
所以我的问题有两方面:
下面是我目前使用的javascript和HTML标记。
JavaScript:
$(document).ready(
function()
{
$('#Image1').mapster({
fillOpacity: 0.5,
mapKey: 'alt',
staticState:true,
render_highlight:
{
fillColor: '2aff00',
},
render_select:
{
fillColor: 'ff000c',
}
});
$('#Image2').mapster({
mapKey: 'alt',
stroke: true,
strokeOpacity: 1.0,
strokeColor: '000000',
strokeWidth: 2,
fill: true,
fillColor: '0000ff',
fillOpacity: 0.25,
render_select:
{
fillOpacity: 0.75,
fillColor: 'ff0000'
},
render_highlight:
{
fillOpacity: 0.5,
fillColor: '00ff00'
}
})
}
); 标记:
<img id="Image1" src="bicycleparts.png" usemap="#ImageMap1" />
<map name="ImageMap1" id="ImageMap1">
<area shape="circle" coords="100,50,50" href="" title="1" alt="1" onMouseOver="$('#Image1').mapster('highlight','1')" onMouseOut="$('#Image1').mapster('highlight',false)" />
<area shape="circle" coords="200,100,50" href="" title="2" alt="2" onMouseOver="$('#Image1').mapster('highlight','2')" onMouseOut="$('#Image1').mapster('highlight',false)" />
<area shape="circle" coords="300,150,50" href="" title="3" alt="3" onMouseOver="$('#Image1').mapster('highlight','3')" onMouseOut="$('#Image1').mapster('highlight',false)" />
<area shape="circle" coords="400,200,50" href="" title="4" alt="4" onMouseOver="$('#Image1').mapster('highlight','4')" onMouseOut="$('#Image1').mapster('highlight',false)" />
<area shape="circle" coords="500,250,50" href="" title="5" alt="5" onMouseOver="$('#Image1').mapster('highlight','5')" onMouseOut="$('#Image1').mapster('highlight',false)" />
</map>
<img id="Image2" src="bicycleparts.png" usemap="#ImageMap2" />
<map name="ImageMap2" id="ImageMap2">
<area shape="circle" coords="100,50,50" href="" title="1" alt="1"/>
<area shape="circle" coords="200,100,50" href="" title="2" alt="2"/>
<area shape="circle" coords="300,150,50" href="" title="3" alt="3"/>
<area shape="circle" coords="400,200,50" href="" title="4" alt="4"/>
<area shape="circle" coords="500,250,50" href="" title="5" alt="5"/>
</map>发布于 2012-10-16 14:32:21
解决这一问题的方法是确保href不是空白。在我的例子中,如果我设置了href="#",那么ImageMapster就能正常工作--在标签上没有mouseover/mouseout函数的情况下高亮显示。
现在对于C#,我可以设置CircleHotSpot.NavigateURL = "#",它可以编程地解决我的解决方案。
感谢@joshing报的解决方案。
https://stackoverflow.com/questions/12859896
复制相似问题