/*Featured Image Zoomer (May 8th, 2010) * This notice must stay intact for usage * Author: Dynamic Drive at http://www.dynamicdrive.com/ * Visit http://www.dynamicdrive.com/ for full source code */ // Feb 21st, 2011: Script updated to v1.5, which now includes new feature by jscheuer1 (http://www.dynamicdrive.com/forums/member.php?u=2033) to show optional "magnifying lens" while over thumbnail image. // March 1st, 2011: Script updated to v1.51. Minor improvements to inner workings of script. jQuery.noConflict() jQuery('head').append(''); var featuredimagezoomer={ loadinggif: 'spinningred.gif', //full path or URL to "loading" gif magnifycursor: 'crosshair', //Value for CSS's 'cursor' attribute, added to original image /////NO NEED TO EDIT BEYOND HERE//////////////// dsetting: { //default settings magnifierpos: 'right', magnifiersize:[200, 200], cursorshadecolor: '#fff', cursorshadeopacity: 0.3, cursorshadeborder: '1px solid black', cursorshade: false, leftoffset: 15, //offsets here are used (added to) the width of the magnifyarea when rightoffset: 10 //calculating space requirements and to position it visa vis any drop shadow }, isie: (function(){/*@cc_on @*//*@if(@_jscript_version >= 5)return true;@end @*/return false;})(), //is this IE? showimage: function($, $tracker, $mag, showstatus){ var specs=$tracker.data('specs'), d=specs.magpos, fiz=this; var coords=$tracker.data('specs').coords //get coords of tracker (from upper corner of document) specs.windimensions={w:$(window).width(), h:$(window).height()}; //remember window dimensions var magcoords={} //object to store coords magnifier DIV should move to magcoords.left = coords.left + (d === 'left'? -specs.magsize.w - specs.lo : $tracker.width() + specs.ro); //switch sides for magnifiers that don't have enough room to display on the right if there's room on the left: if(d!=='left' && magcoords.left + specs.magsize.w + specs.lo >= specs.windimensions.w && coords.left - specs.magsize.w >= specs.lo){ magcoords.left = coords.left - specs.magsize.w - specs.lo; } else if(d==='left' && magcoords.left < specs.ro) { //if there's no room on the left, move to the right magcoords.left = coords.left + $tracker.width() + specs.ro; } $mag.css({left: magcoords.left, top:coords.top}).show(); //position magnifier DIV on page specs.$statusdiv.html('Current Zoom: '+specs.curpower+'
Use Mouse Wheel to Zoom In/Out
'); if (showstatus) //show status DIV? (only when a range of zoom is defined) fiz.showstatusdiv(specs, 400, 2000); }, hideimage: function($tracker, $mag, showstatus){ var specs=$tracker.data('specs'); $mag.hide(); if (showstatus) this.hidestatusdiv(specs); }, showstatusdiv: function(specs, fadedur, showdur){ clearTimeout(specs.statustimer) specs.$statusdiv.fadeIn(fadedur) //show status div specs.statustimer=setTimeout(function(){featuredimagezoomer.hidestatusdiv(specs)}, showdur) //hide status div after delay }, hidestatusdiv: function(specs){ specs.$statusdiv.stop(true, true).hide() }, getboundary: function(b, val, specs){ //function to set x and y boundaries magnified image can move to (moved outside moveimage for efficiency) if (b=="left"){ var rb=-specs.imagesize.w*specs.curpower+specs.magsize.w return (val>0)? 0 : (val0)? 0 : (val