Vorlage:BildGrossZoom
Aus BogenWiki
(Unterschied zwischen Versionen)
Nugman (Diskussion | Beiträge) |
Nugman (Diskussion | Beiträge) |
||
| Zeile 45: | Zeile 45: | ||
function MouseMove(e) { | function MouseMove(e) { | ||
e.preventDefault(); | e.preventDefault(); | ||
| - | var x = e. | + | e = e || window.event; |
| - | var y = e. | + | /*get the x and y positions of the image:*/ |
| + | var a = img.getBoundingClientRect(); | ||
| + | /*calculate the cursor's x and y coordinates, relative to the image:*/ | ||
| + | var x = e.pageX - a.left; | ||
| + | var y = e.pageY - a.top; | ||
| + | /*consider any page scrolling:*/ | ||
| + | x = x - window.pageXOffset; | ||
| + | y = y - window.pageYOffset; | ||
document.getElementById('BogenBildX').innerHTML = x; | document.getElementById('BogenBildX').innerHTML = x; | ||
document.getElementById('BogenBildY').innerHTML = y; | document.getElementById('BogenBildY').innerHTML = y; | ||
Version vom 22:12, 11. Jul. 2018
| [[{{{Gebiet}}} MiNr. {{{SatzMiNr}}}#Bogen_{{{Bild}}}|Zurück]] | ||
|
| ||
| X = ..., y = ... | ClientWidth = ..., ClientHeight = ..., bFollowMouseMove = ... | ||
| [[{{{Gebiet}}} MiNr. {{{SatzMiNr}}}#Bogen_{{{Bild}}}|Zurück]] | ||
