I am using setAttribute
and getAttribute
to display a higher resolution image. The src stores the low resolution image and data-src stores the high resolution image.
The HTML code would look something like this:
<img class="image" src="img/lowres.png" data-src="img/highres.png">
The javascript code would look something like this:
image.setAttribute("src",image.getAttribute("data-src"));
Do I have any access to run any code before the src changes into the data-src? For example fade out the src image and fade in the data-src image?
The code is executed on a button press.