Whether one element stacks above or below another element when they both occupy some of the same space on the page depends upon its z-index. In the script, that is done here:
Code:
if (e.ims[i].d && times > e.ims[i].jump){
++e.ims[i].jump;
im.parentNode.style.zIndex = 3;
e.ims[i].timer = setTimeout(resize, speed);
} else if (!e.ims[i].d && e.ims[i].jump > 0){
--e.ims[i].jump;
im.parentNode.style.zIndex = 2;
e.ims[i].timer = setTimeout(resize, speed);
} else if (!e.ims[i].d && e.ims[i].jump < 1){
im.parentNode.style.zIndex = '';
im.style.visibility = 'hidden';
As you can see, what is being affected is the image's parent node. Which normally would be the the division, but once you introduce the link, the division becomes the parent parent node.
If all of your images are going to be linked, this may work:
Code:
if (e.ims[i].d && times > e.ims[i].jump){
++e.ims[i].jump;
im.parentNode.parentNode.style.zIndex = 3;
e.ims[i].timer = setTimeout(resize, speed);
} else if (!e.ims[i].d && e.ims[i].jump > 0){
--e.ims[i].jump;
im.parentNode.parentNode.style.zIndex = 2;
e.ims[i].timer = setTimeout(resize, speed);
} else if (!e.ims[i].d && e.ims[i].jump < 1){
im.parentNode.parentNode.style.zIndex = '';
im.style.visibility = 'hidden';
Or you could just get rid of the division, move its class designations to the a tag, give the the a tag display:block.
There are various other things that may be tried, such as using a helper function to find the ancestor node with the appropriate class designation, or changing the zIndex on both the parent and the parent's parent. But if one of the above solutions works for you, I don't see much reason to worry about it.
Bookmarks