1(function($){ 2 3 $.fn.jqueryzoom = function(options){ 4 var settings = { 5 xzoom: 316,//zoomed width default width 6 yzoom: 282,//zoomed div default width 7 offset:20, //zoomed div default offset 8 position: "right",//zoomed div default position,offset position is to the right of the image 9 lens:1, //zooming lens over the image,by default is 1; 10 preload: 1 11 }; 12 13 if(options) { 14 $.extend(settings, options); 15 } 16 17 var noalt=''; 18 $(this).hover(function(){ 19 20 var imageLeft = this.offsetLeft; 21 var imageRight = this.offsetRight; 22 var imageTop = $(this).get(0).offsetTop; 23 var imageWidth = $(this).children('img').get(0).offsetWidth; 24 var imageHeight = $(this).children('img').get(0).offsetHeight; 25 26 27 noalt= $(this).children("img").attr("alt"); 28 29 var bigimage = $(this).children("img").attr("jqimg"); 30 31 $(this).children("img").attr("alt",''); 32 33 if($("div.zoomdiv").get().length == 0){ 34 35 $(this).after("<div class='zoomdiv'><img class='bigimg' src='"+bigimage+"'/></div>"); 36 37 38 $(this).append("<div class='jqZoomPup'> </div>"); 39 40 } 41 42 43 if(settings.position == "right"){ 44 45 //if(imageLeft + imageWidth + settings.offset + settings.xzoom > screen.width){ 46 47 //leftpos = imageLeft - settings.offset - settings.xzoom; 48 //ipad 49 50 //}else{ 51 52 leftpos = imageLeft + imageWidth + settings.offset; 53 54 //} 55 }else{ 56 leftpos = imageLeft - settings.xzoom - settings.offset; 57 if(leftpos < 0){ 58 59 leftpos = imageLeft + imageWidth + settings.offset; 60 61 } 62 63 } 64 65 $("div.zoomdiv").css({ top: imageTop,left: leftpos }); 66 67 $("div.zoomdiv").width(settings.xzoom); 68 69 $("div.zoomdiv").height(settings.yzoom); 70 71 $("div.zoomdiv").show(); 72 73 if(!settings.lens){ 74 $(this).css('cursor','crosshair'); 75 } 76 77 78 79 80 $(document.body).mousemove(function(e){ 81 82 83 84 mouse = new MouseEvent(e); 85 86 /*$("div.jqZoomPup").hide();*/ 87 88 89 var bigwidth = $(".bigimg").get(0).offsetWidth; 90 91 var bigheight = $(".bigimg").get(0).offsetHeight; 92 93 var scaley ='x'; 94 95 var scalex= 'y'; 96 97 98 if(isNaN(scalex)|isNaN(scaley)){ 99 100 var scalex = (bigwidth/imageWidth); 101 102 var scaley = (bigheight/imageHeight); 103 104 105 106 107 $("div.jqZoomPup").width((settings.xzoom)/scalex ); 108 109 $("div.jqZoomPup").height((settings.yzoom)/scaley); 110 111 if(settings.lens){ 112 $("div.jqZoomPup").css('visibility','visible'); 113 } 114 115 } 116 117 118 119 xpos = mouse.x - $("div.jqZoomPup").width()/2 - imageLeft; 120 121 ypos = mouse.y - $("div.jqZoomPup").height()/2 - imageTop ; 122 123 if(settings.lens){ 124 125 xpos = (mouse.x - $("div.jqZoomPup").width()/2 < imageLeft ) ? 0 : (mouse.x + $("div.jqZoomPup").width()/2 > imageWidth + imageLeft ) ? (imageWidth -$("div.jqZoomPup").width() -2) : xpos; 126 127 ypos = (mouse.y - $("div.jqZoomPup").height()/2 < imageTop ) ? 0 : (mouse.y + $("div.jqZoomPup").height()/2 > imageHeight + imageTop ) ? (imageHeight - $("div.jqZoomPup").height() -2 ) : ypos; 128 129 } 130 131 132 if(settings.lens){ 133 134 $("div.jqZoomPup").css({ top: ypos,left: xpos }); 135 136 } 137 138 139 140 scrolly = ypos; 141 142 $("div.zoomdiv").get(0).scrollTop = scrolly * scaley; 143 144 scrollx = xpos; 145 146 $("div.zoomdiv").get(0).scrollLeft = (scrollx) * scalex ; 147 148 149 }); 150 },function(){ 151 152 $(this).children("img").attr("alt",noalt); 153 $(document.body).unbind("mousemove"); 154 if(settings.lens){ 155 $("div.jqZoomPup").remove(); 156 } 157 $("div.zoomdiv").remove(); 158 159 }); 160 161 count = 0; 162 } 163 164})(jQuery); 165 166function MouseEvent(e) { 167this.x = e.pageX 168this.y = e.pageY 169 170 171} 172
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.