移动新ui
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
hb_cyjc_yd/WebRoot/js/imgzoom/jquery.artZoom.min.js

9 lines
5.9 KiB

/*
* artZoom 1.0.7
* Date: 2011-06-22
* (c) 2009-2011 TangBin, http://www.planeArt.cn
*
* This is licensed under the GNU LGPL, version 2.1 or later.
* For details, see: http://creativecommons.org/licenses/LGPL/2.1/
*/
(function($,_,C){_.fn.artZoom=function(L){L=_.extend({},_.fn.artZoom.defaults,L);var I,F,K=this,E={},J=L.path,H=J+"/loading.gif",G=J+"/zoomin.cur",D=J+"/zoomout.cur";new Image().src=H;G="url('"+G+"'), pointer";D="url('"+D+"'), pointer";I=["<div class=\"ui-artZoom-toolbar\" style=\"display:none\">","<span class=\"ui-artZoom-buttons\" style=\"display:none\">","<a href=\"#\" data-go=\"left\" class=\"ui-artZoom-left\"><span></span>",L.left,"</a>","<a href=\"#\" data-go=\"right\" class=\"ui-artZoom-right\"><span></span>",L.right,"</a>","<a href=\"#\" data-go=\"source\" class=\"ui-artZoom-source\"><span></span>",L.source,"</a>","<a href=\"#\" data-go=\"hide\" class=\"ui-artZoom-hide\"><span></span>",L.hide,"</a>","</span>","<span class=\"ui-artZoom-loading\">","<img data-live=\"stop\" src=\"",H,"\" style=\"","display:inline-block;*zoom:1;*display:inline;vertical-align:middle;","width:16px;height:16px;\""," />"," <span>Loading..</span>","</span>","</div>","<div class=\"ui-artZoom-box\" style=\"display:none\">","<span class=\"ui-artZoom-photo\" data-go=\"hide\""," style=\"display:inline-block;*display:inline;*zoom:1;overflow:hidden;position:relative;cursor:",D,"\">","<img data-name=\"thumb\" data-go=\"hide\" data-live=\"stop\" src=\"",H,"\" />","</span>","</div>"].join("");this.live("click",function(O){if(this.nodeName!=="IMG"&&this.getAttribute("data-live")==="stop")return false;var P,J,K=this,Q=_(K),N=Q.parent(),T=K.src,F=Q.attr("data-artZoom-show")||T,M=Q.attr("data-artZoom-source")||F,R=L.maxWidth||(N[0].nodeName==="A"?Q.parent():Q).parent().width(),S=L.maxHeight||99999;R=R-L.borderWidth;if(N[0].nodeName==="A"){F=N.attr("data-artZoom-show")||N.attr("href");M=N.attr("data-artZoom-source")||N.attr("rel")}if(!Q.data("artZoom")){var D=$.createElement("div"),H,G,E;P=_(D);D.className="ui-artZoom ui-artZoom-noLoad";D.innerHTML=I;(N[0].nodeName==="A"?Q.parent():Q).before(D);Q.data("artZoom",P);G=P.find(".ui-artZoom-box");H=P.find("[data-name=thumb]");A(F,function(){var A=this.width,$=this.height,_=Math.min(R,A);$=_/A*$;A=_;H.attr("src",T).css(L.blur?{width:A+"px",height:$+"px"}:{display:"none"}).after(["<img class=\"ui-artZoom-show\" title=\"",K.title,"\" alt=\"",K.alt,"\" src=\"",F,"\" style=\"width:",A,"px;height:",$,"px;position:absolute;left:0;top:0;background:transparent\""," />"].join(""));E=P.find(".ui-artZoom-show");H.attr("class","ui-artZoom-show");P.addClass("ui-artZoom-ready");P.find(".ui-artZoom-buttons").show();Q.data("artZoom-ready",true);Q.hide();G.show()},function(){H.removeAttr("class").hide();E.css({position:"static",left:"auto",top:"auto"});P.removeClass("ui-artZoom-noLoad");P.find(".ui-artZoom-loading").hide();Q.data("artZoom-load",true)},function(){P.addClass("ui-artZoom-error");C("jQuery.fn.artZoom: Load \""+F+"\" Error!")})}else Q.hide();P=Q.data("artZoom");J=function(A){var C=this,E=C.getAttribute("data-go"),D=C.getAttribute("data-live"),_=Q.data("artZoom-degree")||0,$=P.find(".ui-artZoom-show")[0];if(D==="stop")return false;if(/img|canvas$/i.test(C.nodeName))E="hide";switch(E){case"left":_-=90;_=_===-90?270:_;break;case"right":_+=90;_=_===360?0:_;break;case"source":window.open(M||F||T);break;case"hide":Q.show();P.find(".ui-artZoom-toolbar").hide();P.hide();P.find("[data-go]").die("click",J);break}if((E==="left"||E==="right")&&Q.data("artZoom-load")){B($,_,R,S);Q.data("artZoom-degree",_)}return false};P.show().find(".ui-artZoom-toolbar").slideDown(150);P.find("[data-go]").live("click",J);return false});this.live("mouseover",function(){if(this.className!=="ui-artZoom-show")this.style.cursor=G});if(this[0])this[0].style.cursor=G;return this};_.fn.artZoom.defaults={path:"./images",left:"\u5de6\u65cb\u8f6c",right:"\u53f3\u65cb\u8f6c",source:"\u770b\u539f\u56fe",hide:"\xd7",blur:true,preload:true,maxWidth:null,maxHeight:null,borderWidth:18};var B=_.imgRotate=function(){var _="{$canvas}",A=!!$.createElement("canvas").getContext;return function(J,K,M,N){var P,O,H,F=1,B=J.naturalWidth,L=J.naturalHeight,C=J[_];if(!J[_]){if(!("naturalWidth"in J)){var D=J.runtimeStyle,I=D.width,E=D.height;D.width=D.height="auto";J.naturalWidth=B=J.width;J.naturalHeight=L=J.height;D.width=I;D.height=E}J[_]=C=$.createElement(A?"canvas":"span");J.parentNode.insertBefore(C,J.nextSibling);J.style.display="none";C.className=J.className;C.title=J.title;if(!A){C.img=$.createElement("img");C.img.src=J.src;C.appendChild(C.img);C.style.cssText="display:inline-block;*zoom:1;*display:inline;"+"padding:0;margin:0;border:none 0;position:static;float:none;overflow:hidden;width:auto;height:auto"}}var G=function($){if($)B=[L,L=B][0];if(B>M){F=M/B;L=F*L;B=M}if(L>N){F=F*N/L;B=N/L*B;L=N}if(A)($?L:B)/J.naturalWidth};switch(K){case 0:P=0;O=0;G();break;case 90:P=0;O=-J.naturalHeight;G(true);break;case 180:P=-J.naturalWidth;O=-J.naturalHeight;G();break;case 270:P=-J.naturalWidth;O=0;G(true);break}if(A){C.setAttribute("width",B);C.setAttribute("height",L);H=C.getContext("2d");H.rotate(K*Math.PI/180);H.scale(F,F);H.drawImage(J,P,O)}else{C.style.width=B+"px";C.style.height=L+"px";C.img.style.filter="progid:DXImageTransform.Microsoft.BasicImage(rotation="+K/90+")";C.img.width=J.width*F;C.img.height=J.height*F}}}(),A=(function(){var B=[],A=null,_=function(){var _=0;for(;_<B.length;_++)B[_].end?B.splice(_--,1):B[_]();!B.length&&$()},$=function(){clearInterval(A);A=null};return function(K,J,I,D){var H,E,C,G,$,F=new Image();F.src=K;if(F.complete){J.call(F);I&&I.call(F);return}E=F.width;C=F.height;F.onerror=function(){D&&D.call(F);H.end=true;F=F.onload=F.onerror=null};H=function(){G=F.width;$=F.height;if(G!==E||$!==C||G*$>1024){J.call(F);H.end=true}};H();F.onload=function(){!H.end&&H();I&&I.call(F);F=F.onload=F.onerror=null};if(!H.end){B.push(H);if(A===null)A=setInterval(_,40)}}})()}(document,jQuery,function($){window.console&&console.log($)}))