HTML:
<img id="exit_alert" src="./img/exit.png" usemap="#exit_alert_sure" />
<map name="exit_alert_sure" id="exit_alert_sure">
<area shape="rect" coords="323, 20, 372, 68" class="shade" href="javascript:;" />
<area shape="rect" coords="79, 235, 326, 292" href="index.jsp" />
</map>
CSS:
#exit_alert {display: none; position: absolute; z-index: 4;}
JS:
$('#exit').click(function() {
$('#shade').css('display', 'inline-block');
$('#exit_alert').css('display', 'inline-block');
});
$('#shade,.shade').click(function() {
$('#shade').css('display', 'none');
$('#exit_alert').css('display', 'none');
})
// 圖片的位置是動(dòng)態(tài)計(jì)算的
$('#exit_alert').css({
'left': transformRatio(areas.exitAlert, mapRatio)[0],
'top': transformRatio(areas.exitAlert, mapRatio)[1]
});
在chrome下, 圖片的真實(shí)尺寸是 392 * 376, 而實(shí)際的渲染尺寸是 491 * 467, 在其他瀏覽器下(IE9+, firefox, Opera)沒有問題, 顯示的尺寸與真實(shí)尺寸一致。
很是費(fèi)解, 求賜教!
Tetapkan imej kepada tahap menyekat, dengan 100% lebar dan tinggi
Saya juga menghadapi masalah ini dan mencuba banyak kaedah tetapi tidak berhasil.