New Posts

If you have a design or makeup blog, or if you are using before and after image comparison, this script will surely be very useful for you.

In this tutorial we'll learn how to add the Before/After plugin, a script that works with jQuery and displays two pictures dynamically for comparing them at the same time. By dragging sideways a small bar we can see both images that are being compared.

See this Brittany Murphy pic before and after photoshop:

Implementing this script is simple, we just need jQuery, the Before/After script, and the two images that we are going to compare.

Step 2. Click on the Save template buttonNote: if the above script doesn't work for you, add it above the </body> tag. Also please verify if you have added jQuery in your template (if you did so, then remove the line in green)

<div id='beforeafter1'><div><img alt='before' src='URL of the first image' width='500' height='291'/></div><div><img alt='after' src='URL of the second image' width='500' height='291'/></div></div>

Add the URL of the first image that is the Before image, and the URL of the second image that is the After image.It is important that you have specified the width and height of each picture so that they work on all browsers.If you want to add more images just change the ID of the container, in this case the container is called beforeafter1 so you need to change it to beforeafter2 and so on, although you can choose any name as long as all are different.

And in the first code to paste, add another line like this one in blue:

You can add as many before/after images as you like as long as all containers have a different ID and the corresponding lines are added in the script.Below each photo container are the "Show only Before" and "Show only after" links that when you click on them, the complete pictures will be shown. If you want to hide these links, then just change true to false in the first code and they will not be displayed anymore.

Note: if you see white space around the drag icons, then search for this code in your template: