PATH:
home
/
lab2454c
/
costbloc.com
/
public
/
frontend
/
assets
/
product-carousel-magnifying
(function(a,b){function c(){q.append("<div class='exzoom_img_ul_outer'></div>"),y.append("<p class='exzoom_nav_inner'></p>"),t=q.find(".exzoom_img_ul_outer"),z=y.find(".exzoom_nav_inner"),t.append(u);for(let a=0;a<G;a++){I[a]=o(D.eq(a));let b=u.find("li").eq(a);b.css("width",r),b.find("img").css({"margin-top":I[a][5],width:I[a][3]})}B=y.find("span"),C=2*T.navBorder+T.navHeight,T.exzoom_navWidth=(C+T.navItemMargin)*T.navItemNum,T.exzoom_nav_innerWidth=(C+T.navItemMargin)*G,B.eq(H).addClass(A),y.css({height:C+"px",width:r-E.width()-F.width()}),z.css({width:T.exzoom_nav_innerWidth+"px"}),B.css({"margin-left":T.navItemMargin+"px",width:T.navWidth+"px",height:T.navHeight+"px"}),w=r*G,x=r*(G-1),u.css("width",w),q.append(` <div class='exzoom_zoom_outer'> <span class='exzoom_zoom'></span> </div> <p class='exzoom_preview'> <img class='exzoom_preview_img' src='' /> </p> `),J=q.find(".exzoom_zoom"),K=q.find(".exzoom_main_img"),L=q.find(".exzoom_zoom_outer"),M=q.find(".exzoom_preview"),N=q.find(".exzoom_preview_img"),q.css({width:s+"px",height:s+"px"}),t.css({width:s+"px",height:s+"px"}),M.css({width:s+"px",height:s+"px",left:s+5+"px"}),m(I[H]),l(),h()}function d(a){let b=setInterval(function(){let d=0,e=a.length;a.each(function(){this.complete&&d++}),d===e&&(clearInterval(b),c())},100)}function e(a){let c,d,f=a||b.event,e=f;return void 0!==f.touches&&0<f.touches.length&&(e=f.touches[0]),c=e.clientX||e.pageX,d=e.clientY||e.pageY,{x:c,y:d}}function f(a){return-a>x?(a=-x,H=0):0<a&&(a=0),a}function h(){u.on("touchstart",function(a){let c=e(a);P=c.x,Q=c.y;let d=u.css("left");v=parseInt(d),b.clearInterval(O)}),u.on("touchmove",function(a){let b,c=e(a);R=c.x,S=c.y,b=v+R-P,b=f(b),u.css("left",b)}),u.on("touchend",function(){console.log(R<P),R<P?j():R>P&&k(),l()}),L.on("mousedown",function(a){let b=e(a);P=b.x,Q=b.y;let c=u.css("left");v=parseInt(c)}),L.on("mouseup",function(){let a=p.offset();P-a.left<r/2?k():P-a.left>r/2&&j()}),p.on("mouseenter",function(){b.clearInterval(O)}),p.on("mouseleave",function(){l()}),L.on("mouseenter",function(){J.css("display","block"),M.css("display","block")}),L.on("mousemove",function(a){let b=J.width()/2,c=L.width()-b,d=L.height()-b,e=a.pageX-L.offset().left,f=a.pageY-L.offset().top,g=e-b,h=f-b;e<=b&&(g=0),e>=c&&(g=c-b),f<=b&&(h=0),f>=d&&(h=d-b),J.css({left:g+"px",top:h+"px"}),N.css({left:-g*M.width()/J.width()+"px",top:-h*M.width()/J.width()+"px"})}),L.on("mouseleave",function(){J.css("display","none"),M.css("display","none")}),M.on("mouseenter",function(){J.css("display","none"),M.css("display","none")}),F.on("click",function(){j()}),E.on("click",function(){k()}),B.on("click",function(){H=a(this).index(),i(H)})}function i(a){"undefined"==typeof a&&alert("exzoom \u4E2D\u7684 move \u51FD\u6570\u7684 direction \u53C2\u6570\u5FC5\u586B"),H>I.length-1&&(H=0),B.eq(H).addClass(A).siblings().removeClass(A);let b=y.width(),c=T.navItemMargin+T.navWidth+2*T.navBorder,d=0,e=c*(H+1);e>b&&(d=r-e),z.css({left:d});let g=-r*H;g=f(g),u.stop().animate({left:g},500),m(I[H])}function j(){H++,H>G&&(H=G),i("right")}function k(){H--,0>H&&(H=0),i("left")}function l(){T.autoPlay&&(O=b.setInterval(function(){H>=G&&(H=0),H++,i("right")},T.autoPlayTimeout))}function m(a){void 0===a||(N.attr("src",a[0]),K.attr("src",a[0]).css({width:a[3]+"px",height:a[4]+"px"}),L.css({width:a[3]+"px",height:a[4]+"px",top:a[5]+"px",left:a[6]+"px",position:"relative"}),J.css({width:a[7]+"px",height:a[7]+"px"}),N.css({width:a[8]+"px",height:a[9]+"px"}))}function n(a,b){let c=new Image;return c.src=a,"undefined"==typeof b?{width:c.width,height:c.height}:void(c.complete?b(c.width,c.height):c.onload=function(){b(c.width,c.height)})}function o(a,b,c){let d,e=[];if("string"==typeof a)d=a;else{d=a.attr("src");let e=n(d);b=e.width,c=e.height}e[0]=d,e[1]=b,e[2]=c;let f=e[1]/e[2];if(1==f)e[3]=s,e[4]=s,e[5]=0,e[6]=0,e[7]=s/2,e[8]=2*s,e[9]=2*s,z.append(`<span><img src="${d}" width="${T.navWidth}" height="${T.navHeight}"/></span>`);else if(1<f){e[3]=s,e[4]=s/f,e[5]=(s-e[4])/2,e[6]=0,e[7]=e[4]/2,e[8]=2*s*f,e[9]=2*s;let a=(T.navHeight-T.navWidth/f)/2;z.append(`<span><img src="${d}" width="${T.navWidth}" style='top:${a}px;' /></span>`)}else if(1>f){e[3]=s*f,e[4]=s,e[5]=0,e[6]=(s-e[3])/2,e[7]=e[3]/2,e[8]=2*s,e[9]=2*s/f;let a=(T.navWidth-T.navHeight*f)/2;z.append(`<span><img src="${d}" height="${T.navHeight}" style="left:${a}px;"/></span>`)}return e}let p=null,q=null,r=null,s=null,t=null,u=null,v=0,w=0,x=0,y=null,z=null,A="current",B=null,C=null,D=null,E=null,F=null,G=0,H=0,I=[],J=null,K=null,L=null,M=null,N=null,O=null,P=0,Q=0,R=0,S=0,T={},g={navWidth:60,navHeight:60,navItemNum:5,navItemMargin:7,navBorder:1,autoPlay:!0,autoPlayTimeout:2e3},U={init:function(b){let c=a.extend({},g,b);p=this,q=p.find(".exzoom_img_box"),u=p.find(".exzoom_img_ul"),y=p.find(".exzoom_nav"),E=p.find(".exzoom_prev_btn"),F=p.find(".exzoom_next_btn"),s=r=p.outerWidth(),T.navWidth=c.navWidth,T.navHeight=c.navHeight,T.navBorder=c.navBorder,T.navItemMargin=c.navItemMargin,T.navItemNum=c.navItemNum,T.autoPlay=c.autoPlay,T.autoPlayTimeout=c.autoPlayTimeout,D=q.find("img"),G=D.length,d(D)},prev:function(){k()},next:function(){j()},setImg:function(){let a=arguments[0];n(a,function(b,c){N.attr("src",a),K.attr("src",a),u.find("li").length===G+1&&u.find("li:last").remove(),u.append("<li style=\"width: "+r+"px;\"><img src=\""+a+"\"></li>");let d=o(a,b,c);m(d)})}};a.fn.extend({exzoom:function(b,c){if(0!==arguments.length&&("object"!=typeof b||c)){if(U[b])return U[b].apply(this,Array.prototype.slice.call(arguments,1));a.error("Method "+b+"does not exist on jQuery.exzomm")}else if(0===this.length)a.error("Selector is empty when call jQuery.exzomm");else return U.init.apply(this,arguments)}})})(jQuery,window); $(".container").imagesLoaded(function(){$("#exzoom").exzoom({autoPlay:!1}),$("#exzoom").removeClass("hidden")});
[-] exzoom.js
[edit]
[+]
..
[-] jquery.exzoom.css
[edit]
[-] jquery.exzoom.min.js
[edit]
[-] imagesloaded.pkgd.min.js
[edit]
[-] jquery.exzoom.js
[edit]