csfieldguide/static/interactives/compression-comparer/js/third-party/before-after.min.js
function drags(e,a,t){e.on("mousedown touchstart",function(s){e.addClass("draggable"),a.addClass("resizable");var i=s.pageX?s.pageX:s.originalEvent.touches[0].pageX,n=e.outerWidth(),o=e.offset().left+n-i,l=t.offset().left,u=t.outerWidth();minLeft=l+10,maxLeft=l+u-n-10,e.parents().on("mousemove touchmove",function(e){var t=e.pageX?e.pageX:e.originalEvent.touches[0].pageX;leftValue=t+o-n,leftValue<minLeft?leftValue=minLeft:leftValue>maxLeft&&(leftValue=maxLeft),widthValue=100*(leftValue+n/2-l)/u+"%",$(".draggable").css("left",widthValue).on("mouseup touchend touchcancel",function(){$(this).removeClass("draggable"),a.removeClass("resizable")}),$(".resizable").css("width",widthValue)}).on("mouseup touchend touchcancel",function(){e.removeClass("draggable"),a.removeClass("resizable")}),s.preventDefault()}).on("mouseup touchend touchcancel",function(){e.removeClass("draggable"),a.removeClass("resizable")})}$(document).ready(function(){$(".interactive-compression-comparer-high").each(function(){var e=$(this),a=e.width()+"px";e.find(".interactive-compression-comparer-low img").css("width",a),drags(e.find(".interactive-compression-comparer-handle"),e.find(".interactive-compression-comparer-low"),e)})}),$(window).resize(function(){$(".interactive-compression-comparer-high").each(function(){var e=$(this),a=e.width()+"px";e.find(".interactive-compression-comparer-low img").css("width",a)})});