/*! zoomify - v0.2.4 - https://github.com/indrimuska/zoomify - (c) 2015 indri muska - mit */ !function(a){zoomify=function(b,c){var d=this;this._zooming=!1,this._zoomed=!1,this._timeout=null,this.$shadow=null,this.$image=a(b).addclass("zoomify"),this.options=a.extend({},zoomify.defaults,this.$image.data(),c),this.$image.on("click",function(){d.zoom()}),a(window).on("resize",function(){d.reposition()}),a(document).on("scroll",function(){d.reposition()})},zoomify.defaults={duration:200,easing:"linear",scale:.9},zoomify.prototype.transition=function(a,b){a.css({"-webkit-transition":b,"-moz-transition":b,"-ms-transition":b,"-o-transition":b,transition:b})},zoomify.prototype.addtransition=function(a){this.transition(a,"all "+this.options.duration+"ms "+this.options.easing)},zoomify.prototype.removetransition=function(b,c){var d=this;cleartimeout(this._timeout),this._timeout=settimeout(function(){d.transition(b,""),a.isfunction(c)&&c.call(d)},this.options.duration)},zoomify.prototype.transform=function(a){this.$image.css({"-webkit-transform":a,"-moz-transform":a,"-ms-transform":a,"-o-transform":a,transform:a})},zoomify.prototype.transformscaleandtranslate=function(a,b,c,d){this.addtransition(this.$image),this.transform("scale("+a+") translate("+b+"px, "+c+"px)"),this.removetransition(this.$image,d)},zoomify.prototype.zoom=function(){this._zooming||(this._zoomed?this.zoomout():this.zoomin())},zoomify.prototype.zoomin=function(){var b=this,c=this.$image.css("transform");this.transition(this.$image,"none"),this.transform("none");var d=this.$image.offset(),e=this.$image.outerwidth(),f=this.$image.outerheight(),g=this.$image[0].naturalwidth||+(1/0),h=this.$image[0].naturalheight||+(1/0),i=a(window).width(),j=a(window).height(),k=math.min(g,i*this.options.scale)/e,l=math.min(h,j*this.options.scale)/f,m=math.min(k,l),n=(-d.left+(i-e)/2)/m,o=(-d.top+(j-f)/2+a(document).scrolltop())/m;this.transform(c),this._zooming=!0,this.$image.addclass("zoomed").trigger("zoom-in.zoomify"),settimeout(function(){b.addshadow(),b.transformscaleandtranslate(m,n,o,function(){b._zooming=!1,b.$image.trigger("zoom-in-complete.zoomify")}),b._zoomed=!0})},zoomify.prototype.zoomout=function(){var a=this;this._zooming=!0,this.$image.trigger("zoom-out.zoomify"),this.transformscaleandtranslate(1,0,0,function(){a._zooming=!1,a.$image.removeclass("zoomed").trigger("zoom-out-complete.zoomify")}),this.removeshadow(),this._zoomed=!1},zoomify.prototype.reposition=function(){this._zoomed&&(this.transition(this.$image,"none"),this.zoomin())},zoomify.prototype.addshadow=function(){var b=this;this._zoomed||(b.$shadow&&b.$shadow.remove(),this.$shadow=a('
'),a("body").append(this.$shadow),this.addtransition(this.$shadow),this.$shadow.on("click",function(){b.zoomout()}),settimeout(function(){b.$shadow.addclass("zoomed")},10))},zoomify.prototype.removeshadow=function(){var a=this;this.$shadow&&(this.addtransition(this.$shadow),this.$shadow.removeclass("zoomed"),this.$image.one("zoom-out-complete.zoomify",function(){a.$shadow&&a.$shadow.remove(),a.$shadow=null}))},a.fn.zoomify=function(b){return this.each(function(){var c=a(this),d=c.data("zoomify");d||c.data("zoomify",d=new zoomify(this,"object"==typeof b&&b)),"string"==typeof b&&["zoom","zoomin","zoomout","reposition"].indexof(b)>=0&&d[b]()})}}(jquery);