HTML代碼:
<img src="img.jpg" alt="img" usemap="#map">
<map name="map">
<area shape="poly" coords="[yourCoords]" alt="img" href="javascript:void(0);" class="punto">
<area shape="poly" coords="[yourCoords]" alt="img" href="javascript:void(0);" class="punto">
<area shape="poly" coords="[yourCoords]" alt="img" href="javascript:void(0);" class="punto">
<area shape="poly" coords="[yourCoords]" alt="img" href="javascript:void(0);" class="punto">
<area shape="poly" coords="[yourCoords]" alt="img" href="javascript:void(0);" class="punto">
<area shape="poly" coords="[yourCoords]" alt="img" href="javascript:void(0);" class="punto">
<area shape="poly" coords="[yourCoords]" alt="img" href="javascript:void(0);" class="punto">
<area shape="poly" coords="[yourCoords]" alt="img" href="javascript:void(0);" class="punto">
<area shape="poly" coords="[yourCoords]" alt="img" href="javascript:void(0);" class="punto">
</map>
JS代碼
$(function(){
$('.map').maphilight({
fillColor: 'ff0000',
fillOpacity:0.4,
stroke:false,
neverOn:true
});
$('.punto').click(function(){
var data = $(this).data('maphilight') || {};
data.alwaysOn=true;
$(this).data('maphilight', data).trigger('alwaysOn.maphilight');;
});
})
@wajiw感謝,簡單的解決方案和作品! – Keith 2011-01-18 23:10:07
@wajiw如果我想在mouseover上顯示內容,但沒有「stick」直到它被點擊,我怎麼可以添加到mouseover功能? – Keith 2011-01-18 23:10:47