They do not increase, what actually happens is that when you click on the “Zoom” text, the image inside the div is replaced with a larger version of this image. And the overflow is set to hidden.
, JavaScript DOM, , , .
.
, :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Example</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript">
$(function() {
var fullWidth = 864;
var fullHeight = 648;
var thumbnailWidth = 389;
var thumbnailHeight = 292;
$('#picture').css({
'width': thumbnailWidth+'px',
'height': thumbnailHeight+'px'
});
$('#full').hide();
$('#picture').click(function() {
$('#thumbnail').toggle();
$('#full').toggle();
});
$('#picture').mousemove(function(e) {
var mouseX = e.pageX - $(this).attr('offsetLeft');
var mouseY = e.pageY - $(this).attr('offsetTop');
var posX = (Math.round((mouseX/thumbnailWidth)*100)/100) * (fullWidth-thumbnailWidth);
var posY = (Math.round((mouseY/thumbnailHeight)*100)/100) * (fullHeight-thumbnailHeight);
$('#full').css({
'left': '-' + posX + 'px',
'top': '-' + posY + 'px'
});
});
});
</script>
<style type="text/css">
#picture {
overflow: hidden;
position: relative;
border: 1px solid #000000;
}
#thumbnail {
cursor: pointer;
}
#full {
position: relative;
cursor: crosshair;
}
</style>
</head>
<body>
<div id="picture">
<img alt="" id="thumbnail" src="http://img202.imageshack.us/img202/8403/93629325.jpg" />
<img alt="" id="full" src="http://img111.imageshack.us/img111/4734/tbmecsekyellowflower.jpg" />
</div>
</body>
</html>
. , , imagehack.