!function(b){"use strict";b.fn.fusionImageCompare=function(){return this.each(function(){function o(t){var e=v.width(),i=v.height();return{w:e+"px",h:i+"px",cw:t*e+"px",ch:t*i+"px"}}function a(t){"vertical"===f?(v.css("clip","rect(0,"+t.w+","+t.ch+",0)"),l.css("clip","rect("+t.ch+","+t.w+","+t.h+",0)")):(v.css("clip","rect(0,"+t.cw+","+t.h+",0)"),l.css("clip","rect(0,"+t.w+","+t.h+","+t.cw+")")),c.css("height",t.h),p.addClass("visible")}function e(t){var e=o(t);m.css("vertical"===f?"top":"left","vertical"===f?e.ch:e.cw),a(e)}function i(t,e){return function(t,e,i){return Math.max(e,Math.min(i,t))}("vertical"===f?(e-w)/X:(t-g)/C,0,1)}function t(t){(t.distX>t.distY&&t.distX<-t.distY||t.distX-t.distY)&&"vertical"!==f?t.preventDefault():(t.distXt.distY&&t.distX>-t.distY)&&"vertical"===f&&t.preventDefault(),c.addClass("active"),g=c.offset().left,w=c.offset().top,C=v.width(),X=v.height()}function n(t){c.hasClass("active")&&(r=i(t.pageX,t.pageY),e(r))}function s(){c.removeClass("active")}var c=b(this),r=void 0!==b(this).data("offset")?b(this).data("offset"):.5,f=void 0!==b(this).data("orientation")?b(this).data("orientation"):"horizontal",d=void 0!==b(this).data("move-slider-on-hover")&&b(this).data("move-slider-on-hover"),u=void 0===b(this).data("move-with-handle-only")||b(this).data("move-with-handle-only"),h=void 0!==b(this).data("click-to-move")&&b(this).data("click-to-move"),v=c.find("img:first"),l=c.find("img:last"),m=c.find(".fusion-image-before-after-handle"),p=b(".before-after-label-out-image-up-down"),g=0,w=0,C=0,X=0,Y="";b(window).on("resize.fusion-image-before-after",function(t){e(r)}),(Y=u?c:m).on("movestart",t),Y.on("move",n),Y.on("moveend",s),d&&(c.on("mouseenter",t),c.on("mousemove",n),c.on("mouseleave",s)),m.on("touchmove",function(t){t.preventDefault()}),c.find("img").on("mousedown",function(t){t.preventDefault()}),h&&c.on("click",function(t){var e;g=c.offset().left,w=c.offset().top,C=v.width(),X=v.height(),r=i(t.pageX,t.pageY),e=o(r),c.addClass("active"),"vertical"===f?m.stop(!0,!0).animate({top:e.ch},{queue:!1,duration:300,easing:"easeOutCubic",step:function(t,e){var i=o(t/X);a(i)},complete:function(){c.removeClass("active")}}):m.stop(!0,!0).animate({left:e.cw},{queue:!1,duration:300,easing:"easeOutCubic",step:function(t,e){var i=o(t/C);a(i)},complete:function(){c.removeClass("active")}})}),b(window).trigger("resize.fusion-image-before-after")})}}(jQuery),jQuery(window).load(function(){jQuery(".fusion-image-before-after").fusionImageCompare()});