!function($){var a={callback:!1,target:!1,duration:120,touch:!0,onZoomIn:!1,onZoomOut:!1};$.zoom=function(c,f,a,d){var g,h,i,j,k,l,m,b=$(c),e=b.css("position"),n=$(f);return b.css("position",/(absolute|fixed)/.test(e)?e:"relative"),b.css("overflow","hidden"),a.style.width=a.style.height="",$(a).addClass("zoomImg").css({position:"absolute",top:0,left:0,opacity:0,width:a.width*d,height:a.height*d,border:"none",maxWidth:"none",maxHeight:"none"}).appendTo(c),{init:function(){h=b.outerWidth(),g=b.outerHeight(),f===b[0]?(j=h,i=g):(j=n.outerWidth(),i=n.outerHeight()),k=(a.width-h)/j,l=(a.height-g)/i,m=n.offset()},move:function(d){var b=d.pageX-m.left,c=d.pageY-m.top;c=Math.max(Math.min(c,i),0),b=Math.max(Math.min(b,j),0),a.style.left=-(b*k)+"px",a.style.top=-(c*l)+"px"}}},$.fn.zoom=function(b){return this.each(function(){var c=$.extend({borderStyle:null,borderWidth:null,borderColor:null,imgWidth:!1,magnify:!1,on:!1,url:!1,complete:null},a,b||{}),e=c.target||this,f=this,g=$(f),d=($(e),document.createElement("img")),h=$(d),i="mousemove",j=!1,k=!1;c.borderStyle&&$(this).css("border-style",c.borderStyle),c.borderWidth&&$(this).css("border-width",c.borderWidth),c.borderColor&&$(this).css("border-color",c.borderColor),c.imgWidth&&$(this).css("width",c.imgWidth),c.magnify&&c.magnify,c.on&&c.on,c.url||($urlElement=g.find("img"),c.url=$urlElement.data("zoom_src")),$.isFunction(c.complete)&&c.complete.call(this),d.onload=function(){var a=$.zoom(e,f,d,c.magnify);function b(b){a.init(),a.move(b),h.stop().fadeTo($.support.opacity?c.duration:0,1,!!$.isFunction(c.onZoomIn)&&c.onZoomIn.call(d))}function l(){h.stop().fadeTo(c.duration,0,!!$.isFunction(c.onZoomOut)&&c.onZoomOut.call(d))}"grab"===c.on?g.on("mousedown",function(c){1===c.which&&($(document).one("mouseup",function(){l(),$(document).off(i,a.move)}),b(c),$(document).on(i,a.move),c.preventDefault())}):"click"===c.on?g.on("click",function(c){if(!j)return j=!0,b(c),$(document).on(i,a.move),$(document).one("click",function(){l(),j=!1,$(document).off(i,a.move)}),!1}):"toggle"===c.on?g.on("click",function(a){j?l():b(a),j=!j}):"mouseover"===c.on&&(a.init(),g.on("mouseenter",b).on("mouseleave",l).on(i,a.move)),c.touch&&g.on("touchstart",function(a){a.preventDefault(),k?(k=!1,l()):(k=!0,b(a.originalEvent.touches[0]||a.originalEvent.changedTouches[0]))}).on("touchmove",function(b){b.preventDefault(),a.move(b.originalEvent.touches[0]||b.originalEvent.changedTouches[0])}),$.isFunction(c.callback)&&c.callback.call(d)},d.src=c.url})},$.fn.zoom.defaults=a}(window.jQuery)
Baidu
map