Color Swatch is often a requirement for Magento Stores. You can find lots of Color Swatch Extensions and tutorials on the internet. Most of them are slow in speed in terms of swatching the image. So I am sharing some tips on overcoming that.
You just have to place the following code in app/design/frontend/*/*/catalog/product/view/media.phtml:
Notes: We have used the concept of image preloading using jQuery:
$('<img />').attr('src', $imageUrl)
By Preloading an image means loading an image in browsers cache so that when that image is requested it will be immediately displayed from the cache and hence making the mouseover, swatch operation, etc extremely fast.