It could probably be fine tuned, depending upon - well whatever. But at least it's tested and works (no typos) and will work even with images where you don't want the magnifier made shorter. A different sort of calculation could be done for images that are too narrow, if you have any like that. I'm just not positive at this point if both can be done without interfering with each other. Probably can.
Anyways, here it is:
Code:
<script type="text/javascript">
jQuery(document).ready(function($){
var im = $('#zoom_image'), ratioh, imh, magh;
$(new Image()).load(function(){
im.css({height: imh = im.get(0).offsetHeight});
if((ratioh = imh/im.width() * 500) < 400){
magh = ratioh;
}
im.addimagezoom({
zoomrange: [3,3],
magnifiersize: [500, magh || 400],
magnifierpos: 'right',
cursorshade: true // <-- no comma after last property
});
}).attr('src', im.attr('src'));
});
</script>
But give this one a try too:
Code:
<script type="text/javascript">
jQuery(document).ready(function($){
var im = $('#zoom_image'), ratioh, ratiow, imh, imw, magh, magw;
$(new Image()).load(function(){
im.css({height: imh = im.get(0).offsetHeight});
if((ratioh = imh/(imw = im.width()) * 500) < 400){
magh = ratioh;
} else if ((ratiow = imw/imh + 400) < 500){
magw = ratiow;
}
im.addimagezoom({
zoomrange: [3,3],
magnifiersize: [magw || 500, magh || 400],
magnifierpos: 'right',
cursorshade: true // <-- no comma after last property
});
}).attr('src', im.attr('src'));
});
</script>
It does what I was talking about, checks the other dimension (width) without interfering with the height check. Try it with the picture frames. They don't really need help, but this makes their magnifiers more proportional.
Bookmarks