(function(a,n,m){n.fn.twentytwenty=function(f,q){f=n.extend({handlePosition:.5,orientation:"horizontal",labelBefore:"Before",labelAfter:"After"},f);return this.each(function(){var g=f.handlePosition,c=n(this),e=f.orientation,p="vertical"===e?"down":"left",m="vertical"===e?"up":"right",l=c.find("img:first"),r=c.find("img:last");c.wrap('
');c.append('
');c.append('
'); var b=c.find(".twentytwenty-handle");b.append('');b.append('');c.addClass("twentytwenty-container");l.addClass("twentytwenty-before");r.addClass("twentytwenty-after");p=c.find(".twentytwenty-overlay");p.append('
'+f.labelBefore+"
");p.append('
'+ f.labelAfter+"
");var k=function(a){var d,t,k;k=l.width();var h=l.height();d=k+"px";t=h+"px";k=a*k+"px";a=a*h+"px";b.css("vertical"===e?"top":"left","vertical"===e?a:k);h=c.find(".twentytwenty-before");"vertical"===e?h.css("clip","rect(0,"+d+","+a+",0)"):h.css("clip","rect(0,"+k+","+t+",0)");c.css("height",t);"function"===typeof q&&q()},d=0,t=0,h=0,v=0;n(a).on("resize.twentytwenty",function(a){k(g)});b.on("movestart",function(a){(a.distX>a.distY&&a.distX<-a.distY||a.distX -a.distY)&&"vertical"!==e?a.preventDefault():(a.distXa.distY&&a.distX>-a.distY)&&"vertical"===e&&a.preventDefault();c.addClass("active");d=c.offset().left;t=c.offset().top;h=l.width();v=l.height()});b.on("moveend",function(a){c.removeClass("active")});b.on("move",function(a){c.hasClass("active")&&(g="vertical"===e?(a.pageY-t)/v:(a.pageX-d)/h,0>g&&(g=0),1