jquery(function() { jquery('.smallimglist a').lightbox(); jquery('#gallery a img').click(function(){ jquery('#gallery a').lightbox(); }); /* smallimglist */ jquery("#gallery a").attr("href", jquery('#gallery').children('a').children('img').attr("src")); jquery(".smallimglist li").live('mouseover',function(){ jquery(this).nextall().removeclass("hover"); jquery(this).prevall().removeclass("hover"); jquery(this).addclass("hover"); jquery("#gallery img").attr("src", jquery(this).children('a').children('img').attr("src")); jquery("#gallery img").attr("alt", jquery(this).children('a').children('img').attr("src")); jquery("#gallery a").attr("href", jquery(this).children('a').children('img').attr("src")); }); }); (function($){ $.fn.jqueryzoom = function(options){ var settings = { xzoom: 700, //zoomed width default width yzoom: 525, //zoomed div default width offset: 10, //zoomed div default offset position: "right" //zoomed div default position,offset position is to the right of the image }; if(options) { $.extend(settings, options); } var noalt =''; $(this).hover(function() { var imageleft = $(this).get(0).offsetleft; var imageright = $(this).get(0).offsetright; var imagetop = $(this).get(0).offsettop; var imagewidth = $(this).get(0).offsetwidth; var imageheight = $(this).get(0).offsetheight; var bigimage = $(this).attr("src"); noalt = $(this).attr("src"); $(this).attr("alt",''); //asd if ( noalt==''||noalt==undefined) return false; if ( noalt!=undefined) { if($("div.zoomdiv").get().length == 0 ){ $(this).after("
"); } } if(settings.position == "right") { leftpos = imageleft + imagewidth + settings.offset; } else { leftpos = imageleft - settings.xzoom - settings.offset; } $("div.zoomdiv").css({ top: imagetop,left: leftpos }); $("div.zoomdiv").width(settings.xzoom); $("div.zoomdiv").height(settings.yzoom); $("div.zoomdiv").show(); $(document.body).mousemove(function(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 = math.round(bigwidth/imagewidth) ; var scaley = math.round(bigheight/imageheight); } mouse = new mouseevent(e); scrolly = mouse.y - imagetop - ($("div.zoomdiv").height()*1/scaley)/2 ; $("div.zoomdiv").get(0).scrolltop = scrolly * scaley ; scrollx = mouse.x - imageleft - ($("div.zoomdiv").width()*1/scalex)/2 ; $("div.zoomdiv").get(0).scrollleft = (scrollx) * scalex ; }); },function() { $(this).attr("alt",noalt); $("div.zoomdiv").hide(); $(document.body).unbind("mousemove"); $(".lenszoom").remove(); $("div.zoomdiv").remove(); }); } })(jquery); function mouseevent(e) { this.x = e.x ? e.x : e.pagex// e.pagex this.y = e.y ? e.y : e.pagey// e.pagey } //var $=function(_obj){return document.getelementbyid(_obj);} //jquery.noconflict(); jquery(document).ready(function(){ jquery("#gallery .jqzoom").jqueryzoom({ xzoom: 326, yzoom: 241, offset: 10, position: "right" }); });