Making an image swapper selector in HTML5 that works across devices

I am looking to create a simple image swapper similar to this concept here, it won’t change the colour, but the actual image layer and reveal a texture or different style of paving. But will follow the same concept.

See flash example

I could do something like this in flash, but looking to create something like this in HTML5 so it will be visible on devices if possible. How do I go about finding the code or source files capable of giving me an idea of how I could do this. Any kind of image swapping source code out there would be great.