I'm currently creating an iOS app with Cordova which uses CSS3 animation transitions to fake slide in/out and pop in/out page navigation.
The issue I am currently experiencing is that after the animation completes the images flashes for a fraction of ms (only on mobiles, not visible on desktop). All images are stored locally. By monitoring the timeline I've found that the biggest performance burden is given by the image decoding time. An image of 1020px takes around 24ms to load. If I reduce the image size to 320px the decoding time goes down to 0.9ms. How can I dynamically resize the images to the target view port before the DOM is loaded? I've looked at this answer but I've found it a bit complex for my limited javascript knowledge.
Any tip would be really appreciated.
Daniela