Deferring JS causes layout issues
-
https://www.hatsfromoz.com.au/green-and-cream-racing-fascinator-by-fillies-collection/
Load the page in new incognito window. You will see product images are not quite right. Refreshing the page will get it right, but this is because browser now has its own cashed version.
Problem was traced down to deferring javascript. If this functionality is disabled, page loads normally.
This is pretty much is down to how WooCommerce coded. Far from ideal. It loads products images very inefficiently. Images are loaded, then JS is run and it modifies the layout.
The only way to load the page properly is to exclude
jquery.min.js
woo-product-imagesfrom the JS deferral. But this, in term, really slows down the page. (have to do jquery as woo-product-images depends on it).
So, the question is — why deferring the javascript is not showing page correctly? I would expect wrong layout displayed until page finishes loading, then layout should be fixed. After all, same code is run, in same order, just a bit later.
There are no errors in JS console, so there is no code that runs out of order.
As this particular behavior is native WooCommerce, perhaps you already have the solution and can share?
Any ideas will be greatly appreciated
The page I need help with: [log in to see the link]
- The topic ‘Deferring JS causes layout issues’ is closed to new replies.