I'm in the process of developing a product customization tool that allows users to choose colors for various parts of a bag and see a live preview, similar to this:
My current setup involves using transparent PNG images layered on top of each other as different components of the bag. When a user selects a color swatch, I use the $.attr jQuery function to switch out the image src with a new one based on the selected color attribute.
The issue I'm facing is that there is a noticeable delay between when the user clicks a swatch and when the new image actually loads. This delay negatively impacts the user experience.
I'm looking for advice on best practices to improve this situation. Should I preload all the images upon page load? Are there any innovative solutions to optimize this process?