Interesting effect


Found this interesting image with a cool effect -
(See it here )

If you move the mouse cursor from the left side of this picture to the right one, this picture will be interchanged by another one. Where the first one shows the model made by previous version of this soft, and the second one - the newest version.

I’d like use this feature on my own site as well. Maybe you can give me some clues how to implement it on my site.

Thanks in advance.


I didn’t look at the code at all but you could do something in css like this for modern browsers.

The css and html is all in the head so just view source (bear in mind I just knocked this up in 5 minutes so could be greatly improved upon).

I’ve also put it in a codepen if you want to play around with it:

The example you linked to is obviously using a script for the drag effect and if you want that exact functionality then it will need to be scripted.

1 Like

Here’s a simpler example that uses jquery to change the split of the image.


the js function that do this job is this:

function moveHandle(e) {
    var divider = $(this).find('.as11-compare-divider');

    var touch = e.pageX || e.touches[0].pageX;

    var position = touch - $(this).offset().left;
    if (position < $(this).width() && position > 0) {
      divider.css("left", position);

        var width = $(this).width() - divider.position().left;

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.