/*jqueryzoom&&jcarousel download by http://www.codefans.net*/ (function($){ $.fn.jqueryzoom=function(options){ var settings={ xzoom:200, yzoom:165, offset:10, position:"right", lens:1, preload:1}; if(options){ $.extend(settings,options);} var noalt=''; $(this).hover(function(){ var imageleft=$(this).offset().left; var imagetop=$(this).offset().top; var imagewidth=$(this).children('img').get(0).offsetwidth; var imageheight=$(this).children('img').get(0).offsetheight; noalt=$(this).children("img").attr("alt"); var bigimage=$(this).children("img").attr("jqimg"); $(this).children("img").attr("alt",''); if($("div.zoomdiv").get().length==0){ $(this).after("
"); $(this).append("
 
");} if(settings.position=="right"){ if(imageleft+imagewidth+settings.offset+settings.xzoom>screen.width){ leftpos=imageleft-settings.offset-settings.xzoom;}else{ leftpos=imageleft+imagewidth+settings.offset;}}else{ leftpos=imageleft-settings.xzoom-settings.offset; if(leftpos<0){ leftpos=imageleft+imagewidth+settings.offset;}} $("div.zoomdiv").css({top:imagetop,left:leftpos}); $("div.zoomdiv").width(settings.xzoom); $("div.zoomdiv").height(settings.yzoom); $("div.zoomdiv").show(); if(!settings.lens){ $(this).css('cursor','crosshair');} $(document.body).mousemove(function(e){ mouse=new mouseevent(e); var bigwidth=$(".bigimg").get(0).offsetwidth; var bigheight=$(".bigimg").get(0).offsetheight; var scaley='x'; var scalex='y'; if(isnan(scalex)|isnan(scaley)){ var scalex=(bigwidth/imagewidth); var scaley=(bigheight/imageheight); $("div.jqzoompup").width((settings.xzoom)/(scalex*1)); $("div.jqzoompup").height((settings.yzoom)/(scaley*1)); if(settings.lens){ $("div.jqzoompup").css('visibility','visible');}} xpos=mouse.x-$("div.jqzoompup").width()/2-imageleft; ypos=mouse.y-$("div.jqzoompup").height()/2-imagetop; if(settings.lens){ xpos=(mouse.x-$("div.jqzoompup").width()/2 < imageleft ) ? 0 : (mouse.x + $("div.jqzoompup").width()/2>imagewidth+imageleft)?(imagewidth-$("div.jqzoompup").width()-2):xpos; ypos=(mouse.y-$("div.jqzoompup").height()/2 < imagetop ) ? 0 : (mouse.y + $("div.jqzoompup").height()/2>imageheight+imagetop)?(imageheight-$("div.jqzoompup").height()-2):ypos;} if(settings.lens){ $("div.jqzoompup").css({top:ypos,left:xpos});} scrolly=ypos; $("div.zoomdiv").get(0).scrolltop=scrolly*scaley; scrollx=xpos; $("div.zoomdiv").get(0).scrollleft=(scrollx)*scalex;});},function(){ $(this).children("img").attr("alt",noalt); $(document.body).unbind("mousemove"); if(settings.lens){ $("div.jqzoompup").remove();} $("div.zoomdiv").remove();}); count=0; if(settings.preload){ $('body').append(""); $(this).each(function(){ var imagetopreload=$(this).children("img").attr("jqimg"); var content=jquery('div.jqpreload'+count+'').html(); jquery('div.jqpreload'+count+'').html(content+'');});}}})(jquery); function mouseevent(e){ this.x=e.pagex; this.y=e.pagey;}