Images used are copyrighted and are used for demonstration only.
Download loupe.js and include it into your webpages HEAD section.
<script type="text/javascript" src="loupe.js"></script>
To add a loupe just set the event onload="loupe.add(this);" to an div surrounded image.
<div>
<img id="..." onload="loupe.add(this);" src="..." width="356" height="205" alt="...">
</div>
loupe.defaultResopath = 'images/loupe/'; //STRING path to image resources (loupe.png|lense.png|icon.png)
loupe.defaultVisible = false; //BOOLEAN visiblity on startup
loupe.defaultRadius = 100; //INT/FLOAT 0-100 lense radius (%) of loupe min(height/width)
loupe.defaultXpos = 8; //INT/FLOAT 0-n (px) horizontal offset of the lense
loupe.defaultYpos = 6; //INT/FLOAT 0-n (px) vertical offset of the lense
loupe.defaultXview = 0; //INT/FLOAT 0-n (px) horizontal start position
loupe.defaultYview = 0; //INT/FLOAT 0-n (px) vertical start position
loupe.defaultCrosshair = false; //BOOLEAN show crosshair
loupe.defaultOpacity = 25; //INT/FLOAT 0-100 (%) crosshair opacity
loupe.defaultColor = '#0000ff'; //STRING crosshair color
loupe.defaultName = ''; //STRING (canvas name|id)
loupe.add(image[, options]);
image == div surrounded image
options e.g. {visible: true, opacity: 25, ...}
resopath == STRING Default: 'images/loupe/'
visible == BOOLEAN true or false Default: false
radius == INT/FLOAT 0 - 100 Default: 100
xpos == INT/FLOAT 0 - n Default: 8
ypos == INT/FLOAT 0 - n Default: 6
xview == INT/FLOAT 0 - 100 Default: 0
yview == INT/FLOAT 0 - 100 Default: 0
crosshair == BOOLEAN true or false Default: false
opacity == INT/FLOAT 0 - 100 Default: 25
color == STRING Default: '#0000ff'
name == STRING Default: ''
loupe.toggle(canvas.id);
loupe.remove(canvas);
<img onload="loupe.add(this);" ...>
loupe.add(document.getElementById('img'));
if(typeof $=='undefined') {function $(v) {return(document.getElementById(v));}}
loupe.add($('img'), {name:'magnifier', resopath:'loupes/'});
<button type="button" onclick="loupe.toggle('magnifier');"> toggle </button>
alert('loupe: '+loupe.version+' ('+loupe.released+')');
loupe.remove($('magnifier'));
In older browsers, the script degrades and your visitors won't notice a thing.
Please read the license before you download loupe.js 2.0
Please read the Frequently Asked Questions before you contact the author.
Version 2.0
Please leave any comments at this contact formular.
loupe.js is distributed under the Netzgestade Non-commercial Software License Agreement.
License permits free of charge use on non-commercial and private web sites only under special conditions (as described in the license).
This license equals neither "open source" nor "public domain".
There are also Commercial Software Licenses available.