Here sharing my experiences on recreating a feature where we are comparing two image. The code is available on https://codepen.io/aravi-pen/pen/WPEmga
We will have two images positioned one over the other and a splitter is placed on the center of the image. We have written different mouse handling events to handle this. Check out the code and try to create a preview.
Happy Coding!