Thursday, 11 April 2013

How to - Click one image to reveal another




This code is great when something is being revealed for an event 
(a book cover reveal for example).


The code:


<center>
<script type="text/javascript">
function changeImg(img, newimg) {
img.src = newimg;
}
</script>
<img onclick="changeImg(this, ' URL OF HIDDEN IMAGE ')" src=" URL OF SURFACE IMAGE " />
</center> 


The effect works best with images of the same size. 
That's it folks, nice and simple. If you do have any questions though, please leave a comment or mail me.

Cheers!

No comments :

Post a Comment

Facebook Twitter Google + RSS Feed Email Me