1 2(function($) { 3 $.fn.jqueryzoom = function(options) { 4 var settings = { 5 xzoom: 440, 6 yzoom: 440, 7 offset: 10, 8 position: "right", 9 lens: 1, 10 preload: 1 11 }; 12 if (options) { 13 $.extend(settings, options); 14 } 15 var noalt = ''; 16 $("#ceshi").css("width", "100%"); 17 $("#ceshi").css("height", "100%"); 18 $(this).hover(function() { 19 20 $(this).css("width", $(this).children('img').css("width")); 21 $(this).css("height", $(this).children('img').css("height")); 22 $(this).css("position", "absolute"); 23 24 var imageLeft = $(this).offset().left; 25 var imageTop = $(this).offset().top; 26 var imageWidth = $(this).children('img').get(0).offsetWidth; 27 var imageHeight = $(this).children('img').get(0).offsetHeight; 28 noalt = $(this).children("img").attr("alt"); 29 var bigimage = $(this).children("img").attr("jqimg"); 30 $(this).children("img").attr("alt", ''); 31 if ($("div.zoomdiv").get().length == 0) { 32 $(this).parent().after("<div class='zoomdiv'><img style='width:"+(imageWidth*2)+"px;height:"+(imageHeight*2)+"px;' class='bigimg' src='" + bigimage + "'/></div>"); 33 $(this).append("<div class='jqZoomPup'> </div>"); 34 } 35 if (settings.position == "right") { 36 if (imageLeft + imageWidth + settings.offset + settings.xzoom > screen.width) { 37 leftpos = imageLeft - settings.offset - settings.xzoom; 38 } else { 39 leftpos = imageLeft + imageWidth + settings.offset; 40 } 41 } else { 42 leftpos = imageLeft - settings.xzoom - settings.offset; 43 if (leftpos < 0) { 44 leftpos = imageLeft + imageWidth + settings.offset; 45 } 46 } 47 $("div.zoomdiv").css({ 48 49 }); 50 $("div.zoomdiv").width(settings.xzoom); 51 $("div.zoomdiv").height(settings.yzoom); 52 $("div.zoomdiv").show(); 53 if (!settings.lens) { 54 $(this).css('cursor', 'crosshair'); 55 } 56 $(document.body).mousemove(function(e) { 57 mouse = new MouseEvent(e); 58 var bigwidth = $(".bigimg").get(0).offsetWidth; 59 var bigheight = $(".bigimg").get(0).offsetHeight; 60 var scaley = 'x'; 61 var scalex = 'y'; 62 if (isNaN(scalex) | isNaN(scaley)) { 63 var scalex = (bigwidth / imageWidth); 64 var scaley = (bigheight / imageHeight); 65 $("div.jqZoomPup").width((settings.xzoom) / (scalex * 1)); 66 $("div.jqZoomPup").height((settings.yzoom) / (scaley * 1)); 67 if (settings.lens) { 68 $("div.jqZoomPup").css('visibility', 'visible'); 69 } 70 } 71 xpos = mouse.x - $("div.jqZoomPup").width() / 2 - imageLeft; 72 ypos = mouse.y - $("div.jqZoomPup").height() / 2 - imageTop; 73 if (settings.lens) { 74 xpos = (mouse.x - $("div.jqZoomPup").width() / 2 < imageLeft) ? 0 : (mouse.x + $("div.jqZoomPup").width() / 2 > imageWidth + imageLeft) ? (imageWidth - $("div.jqZoomPup").width()-0) : xpos; 75 ypos = (mouse.y - $("div.jqZoomPup").height() / 2 < imageTop) ? 0 : (mouse.y + $("div.jqZoomPup").height() / 2 > imageHeight + imageTop) ? (imageHeight - $("div.jqZoomPup").height()-0) : ypos; 76 } 77 if (settings.lens) { 78 $("div.jqZoomPup").css({ 79 top: ypos, 80 left: xpos 81 }); 82 } 83 scrolly = ypos; 84 $("div.zoomdiv").get(0).scrollTop = scrolly * scaley; 85 scrollx = xpos; 86 $("div.zoomdiv").get(0).scrollLeft = (scrollx) * scalex; 87 }); 88 }, 89 function() { 90 $(this).children("img").attr("alt", noalt); 91 $(document.body).unbind("mousemove"); 92 if (settings.lens) { 93 $("div.jqZoomPup").remove(); 94 95 } 96 $("div.zoomdiv").remove(); 97 }); 98 count = 0; 99 if (settings.preload) { 100 $('body').append("<div style='display:none;' class='jqPreload" + count + "'></div>"); 101 $(this).each(function() { 102 var imagetopreload = $(this).children("img").attr("jqimg"); 103 var content = jQuery('div.jqPreload' + count + '').html(); 104 jQuery('div.jqPreload' + count + '').html(content + '<img src=\"' + imagetopreload + '\">'); 105 }); 106 } 107 } 108})(jQuery); 109function MouseEvent(e) { 110 this.x = e.pageX; 111 this.y = e.pageY; 112}
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.