We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more

Images loading issue on ajax request in Empire theme

Images loading issue on ajax request in Empire theme

Developer_Jay
Shopify Partner
2 0 0

Hello guys, hope you all are doing well.

 

I'm facing an issue with the Empire theme's latest version. I have created a custom colour option as an individual product and fetched that product on click by jQuery Ajax. But when I make an Ajax request and append fetched product HTML to the page, everything works fine except images. Images are not loading due to the lazyload of the Empire theme. 

 

I've tried it without lazyloading in images, and then images are loading but when I use the Empire theme image rendering way, the images are not loading on Ajax's request.

 

Please help me to solve this issue.

 

Please check that screenshot for more clarification:

Screenshot before click 

Screenshot after click 

 

 

 

 

Replies 3 (3)

MiracleWebsoft
Shopify Partner
50 5 11

To address the issue with images not loading on Ajax requests due to the Empire theme's lazyloading functionality, we recommend considering an alternative approach. Instead of replacing individual elements via Ajax, we suggest utilizing a section copy method. This involves fetching and rendering entire sections of content, including images, ensuring they load correctly within the theme.

 

- Your Coffee Tip can create magic in coding


- Seeking a Shopify Certified Developer? Contact us Shopify Verified partners



If I managed to help you then, don't forget to Like it and Mark it as Solution! 

Developer_Jay
Shopify Partner
2 0 0

Hello @MiracleWebsoft 

 

Thank you for your reply.

 

Can you please guide me on how I can do that?

Felip
Shopify Partner
6 0 2

Sadly @MiracleWebsoft sounded like a classic ChatGPT answer. @Developer_Jay, did you manage to find a solution? I'm facing that same issue.