What I want to achieve:
I want an image swap to occur first when the cursor is over the image (mouse over) and second when the image is clicked (mouse down click).
Example:
I have an image of a green arrow. For the mouse over, it's swapped for an image of a yellow arrow and when clicked swaps an image of a brown arrow (but only so long as the click is held). The default green arrow is always restored.
<img src="green-default.png" />
<img src="yellow-over.png" />
<img src="brown-mousedownclick.png" />
What I've tried:
I've applied a jQuery image swap that works on the mouse over event:
https://github.com/tszming/jquery-swapimage
Example
<script type="text/javascript">
jQuery.swapImage(".swapImage");
</script>
<img src="green-default.png" class="swapImage {src: 'yellow-over.png'}" />
Any advice would be apreciated.
Accepted solution
Senad's solution (below) entailed the use of CSS instead of jQuery. A link element is given a class that styles it to be a block in the dimensions of the images being swapped. The three images are applied as background images to the default, hover and active states of the link element. Senad's solution and demonstration code are posted below.