我试图让一个 div 显示悬停区域的替代文本 - 相对于悬停区域定位。
我可以让文本显示,但不是在正确的位置。
这是我的js:
$(document).ready(function() {
if($('#Map')) {
$('#Map area').each(function() {
var altText = $(this).attr("alt");
$(this).mouseover(function() {
$("#popup").html(altText);
$('#popup').show();
});
$(this).mouseout(function() {
var altText = $(this).attr("alt");
$('#popup').hide();
});
});
}
});