Download "shiftzoom.js" and include it into your webpages HEAD section.
<script type="text/javascript" src="shiftzoom.js"></script>
// only if the cursor images for IE are not in the current path
<scriptscript type="text/javascript">
shiftzoom.defaultCurpath='images/cursors/';
</script>
To add shiftzoom just set the event onload="shiftzoom.add(this);" to an div surrounded image.
<div>
<img onLoad="shiftzoom.add(this);" width="356" height="205" ...>
</div>
shiftzoom.defaultFading = true; //BOOLEAN startup image fadingshiftzoom.defaultOpacity = 70; //INT 0-100 (%) zoom button opacityshiftzoom.defaultMillisec = 30; //INT 5-100 zoom interval delayshiftzoom.defaultIntitle = 'zoom in'; //STR zoom in button title textshiftzoom.defaultOuttitle = 'zoom out'; //STR zoom out button title textshiftzoom.defaultCurpath = ''; //STR cursor path (*.cur) IE onlyshiftzoom.defaultOverview = true; //BOOLEAN show overviewshiftzoom.defaultOvsfact = 25; //INT 10-50 (%) overview size factorshiftzoom.defaultOvaopac = 75; //INT 0-100 (%) overview area opacityshiftzoom.defaultOvacolor = 'red'; //STR overview area css colorshiftzoom.defaultOvbcolor = 'white'; //STR overview border css colorshiftzoom.defaultOvborder = ''; //INT 0-20 (px) or "" overview border widthshiftzoom.add(image[, options]);image == div surrounded imageoptions e.g. {overview: true, opacity: 32, ...}fading == BOOLEAN true or false Default: trueopacity == INT 0 - 100 Default: 90millisec == INT 5 - 100 Default: 40intitle == STRING Default: 'click or press shift key to zoom in'outtitle == STRING Default: 'click or press alt key to zoom out'curpath == STRING Default: ''overview == BOOLEAN true or false Default: trueovsfact == INT 10 - 50 Default: 25ovaopac == INT 0 - 100 Default: 75ovacolor == STRING '#ffaa00' or 'orange' Default: 'red'ovbcolor == STRING '#0000ff' or 'blue' Default: 'white'ovborder == INT 0 - 20 Default: automatic
shiftzoom.remove(image);
<img onLoad="shiftzoom.add(this);" ...>shiftzoom.add(document.getElementById('img'));if(typeof $=='undefined') {function $(v) {return(document.getElementById(v));}}shiftzoom.add($('img'));shiftzoom.add($('img'), {fading:false, curpath:'cursors/'});shiftzoom.remove($('img'));Shows what "shiftzoom.js" does.
In very old browsers, the script degrades and your visitors won't notice a thing.
Operas cursor handling sucks. IE needs external cursor images (*.cur).
ShiftZoom.js is distributed under this LICENSE. License permits free of charge use on non-commercial and private web sites only.
There is also a Commercial Software License available.
Images used are copyrighted and are used for demonstration only.
cvi.netzgesta.de also visit CVI-lab, S5 Reloaded and AJAX-FilmDB