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