I want to change an image when a checkbox is clicked. Until the new image is fully loaded a loader image should appear on top of the current image. While loading the opacity of the current image should also change to 0.5.
The function should therefore consist of the following steps:
On checkbox click:
- Change img src
While loading:
- Set opacity of current image to 0.5
- Display loader.gif
When new image is loaded:
- Change opacity back to 1.0
- Hide loader.gif
- Display new image
How can this be done with jQuery?
Thanks in advance for all proposals!