1 function MagicMove(event) {2 var frame = document.getElementById('MagicFrame');3 var image = document.getElementById('MagicImage');4 5 var Lx = frame.clientWidth;6 var Ly = frame.clientHeight;7 var Mx = image.clientWidth;8 var My = image.clientHeight;9 var Cx = event['layerX'];10 var Cy = event['layerY'];11 12 image.style.marginLeft = '-'+((Mx-Lx)*Cx/Lx)+'px';13 image.style.marginTop = '-'+((My-Ly)*Cy/Ly)+'px';14 }15 16 function MagicOut(event) {17 var image = document.getElementById('MagicImage');18 image.style.marginLeft = '';19 image.style.marginTop = '';20 }
Enlace
El enlace para compartir es: