You don't need to edit the script. The way the script was written, the author intended just two choices of position but, there are really much more.
The obvious two choices are:
1 ) At the position of the mouse when clicked:
Code:
onclick="return enlarge('photo1.jpg',event)"
2 ) In the center of the page:
Code:
onclick="return enlarge('lemoncake.jpg',event,'center',300,375)"
The centering will only work as intended if you give it the true dimensions (red in the above) of the image. This is where it gets interesting. If you give different dimensions, this will shift the position where it gets displayed in the window. Play around with these dimensions and you can get it to show up wherever you like, relative to the center of the window. Don't set it too far from center though. If you do, and the user has a small window/screen, they might not see the image at all.
If you still want to edit the script as you were indicating, replace both the red parts:
Code:
var horzpos=ns6? pageXOffset+e.clientX : ietruebody().scrollLeft+event.clientX
var vertpos=ns6? pageYOffset+e.clientY : ietruebody().scrollTop+event.clientY
with a number (use the same number for both red parts) - use the number of pixels from the left of the window where you want the image to show up at and, replace both of the blue parts with a number (use the same number for both blue parts) - use the number of pixels from the top of the window where you want the image to show up. Be careful here too. If the numbers are too large, the image will be beyond the viewing area of a small window/screen. Example:
Code:
var horzpos=ns6? pageXOffset+175 : ietruebody().scrollLeft+175
var vertpos=ns6? pageYOffset+100 : ietruebody().scrollTop+100
Bookmarks