Ich habe eine Bildkarte über ein Raster. Wenn Sie den Mauszeiger über ein Quadrat halten, wird auf der Seite der Imagemap eine Info angezeigt. Funktioniert wie ein Charme in Chrom; Firefox zeigt die Quadrate viel mehr richtig an ... also Koordinaten sind hier nicht richtig. Muss ich eine spezielle Koordinatenprüfung für Firefox durchführen? oder IE?JS innerhalb FF zeigt unterschiedliche Ausgabe
<body>
<div id="map">
<img src="" id="transparent_map" alt="" usemap="#denkmal_map" />
<img src="http://img.freepik.com/freie-ikonen/quadratischen-raster-symbol_318-70847.jpg" alt="" />
<map name="denkmal_map" id="denkmal_map">
<area alt="" title="" href="#one" shape="rect" coords="7,4,44,43" />
<area alt="" title="" href="#two" shape="rect" coords="45,3,85,42" />
<area alt="" title="" href="#three" shape="rect" coords="87,3,125,41" />
<area alt="" title="" href="#four" shape="rect" coords="6,46,45,83" />
<area alt="" title="" href="#five" shape="rect" coords="43,45,85,83" />
<area alt="" title="" href="#six" shape="rect" coords="87,44,124,84" />
<area alt="" title="" href="#seven" shape="rect" coords="3,82,44,125" />
<area alt="" title="" href="#eight" shape="rect" coords="46,86,84,125" />
<area alt="" title="" href="#nine" shape="rect" coords="85,86,128,125" />
<span id="backer"></span>
</map>
<ul>
<li id="square"><a href="#">Selection</a>
</li>
</ul>
</div>
</body>
Und einige JS-Code
$(this).mouseover(function(e) {
var position = $(this).attr('coords').split(',');
var x = +position[0] + $('map#denkmal_map').position().left;
var y = +position[1] + 9; // $(this).parent().position().top;
console.log('> ' + $(this).attr('coords') + ' > ' + x + '|' + y);
console.log('> ' + $('map#denkmal_map').offset().left + '|' + ($('map#denkmal_map').height()));
$('#backer').css({
top: y - $('map#denkmal_map').position().top + 9,
left: $('map#denkmal_map').position().left + 150
});
$('#square').css({
top: y,
left: x
});
$('#square').show();
});
https://jsfiddle.net/kwzoc73h/