!function(X){X.fn.twentytwenty=function(b){b=X.extend({default_offset_pct:.5,orientation:"horizontal",before_label:"Before",after_label:"After",no_overlay:!1,move_slider_on_hover:!1,move_with_handle_only:!0,click_to_move:!1},b);return this.each(function(){function t(t){((t.distX>t.distY&&t.distX<-t.distY||t.distX<t.distY&&t.distX>-t.distY)&&"vertical"!==o||(t.distX<t.distY&&t.distX<-t.distY||t.distX>t.distY&&t.distX>-t.distY)&&"vertical"===o)&&t.preventDefault(),a.addClass("active"),h=a.offset().left,u=a.offset().top,_=d.width(),m=d.height()}function e(t){a.hasClass("active")&&(i=y(t.pageX,t.pageY),v(i))}function n(){a.removeClass("active")}var i=b.default_offset_pct,a=X(this),o=b.orientation,s="vertical"===o?"down":"left",c="vertical"===o?"up":"right",d=(a.wrap("<div class='twentytwenty-wrapper twentytwenty-"+o+"'></div>"),b.no_overlay||(a.append("<div class='twentytwenty-overlay'></div>"),(g=a.find(".twentytwenty-overlay")).append("<div class='twentytwenty-before-label' data-content='"+b.before_label+"'></div>"),g.append("<div class='twentytwenty-after-label' data-content='"+b.after_label+"'></div>")),a.find("img:first")),l=a.find("img:last"),r=(a.append("<div class='twentytwenty-handle'></div>"),a.find(".twentytwenty-handle")),w=(r.append("<span class='twentytwenty-"+s+"-arrow'></span>"),r.append("<span class='twentytwenty-"+c+"-arrow'></span>"),a.addClass("twentytwenty-container"),d.addClass("twentytwenty-before"),l.addClass("twentytwenty-after"),function(t){var e=d.width(),n=d.height();return{w:e+"px",h:n+"px",cw:t*e+"px",ch:t*n+"px"}}),f=function(t){"vertical"===o?(d.css("clip","rect(0,"+t.w+","+t.ch+",0)"),l.css("clip","rect("+t.ch+","+t.w+","+t.h+",0)")):(d.css("clip","rect(0,"+t.cw+","+t.h+",0)"),l.css("clip","rect(0,"+t.w+","+t.h+","+t.cw+")")),a.css("height",t.h)},v=function(t){t=w(t);r.css("vertical"===o?"top":"left","vertical"===o?t.ch:t.cw),f(t)},p=function(t,e,n){return Math.max(e,Math.min(n,t))},y=function(t,e){return p("vertical"===o?(e-u)/m:(t-h)/_,0,1)},h=(X(window).on("resize.twentytwenty",function(t){v(i)}),0),u=0,_=0,m=0,g=b.move_with_handle_only?r:a;g.on("movestart",t),g.on("move",e),g.on("moveend",n),b.move_slider_on_hover&&(a.on("mouseenter",t),a.on("mousemove",e),a.on("mouseleave",n)),r.on("touchmove",function(t){t.preventDefault()}),a.find("img").on("mousedown",function(t){t.preventDefault()}),b.click_to_move&&a.on("click",function(t){h=a.offset().left,u=a.offset().top,_=d.width(),m=d.height(),i=y(t.pageX,t.pageY),v(i)}),X(window).trigger("resize.twentytwenty")})}}(jQuery);