Why isn't my preloader code functioning in theme.liquid file?

I have added the preloader code to my theme.liquid file in the header section but it’s not working.

1 Like

@KetanKumar @WoodyDev plz help

1 Like

@rehansaeed

{% if template contains 'product' %}
    
  {% endif %}

Try out this code.

This will, help you.

@SpeedyDev

I want to show the brand logo (preloader) on every page of the website, This will not work

@rehansaeed

Add your brand logo url on href

@SpeedyDev not working

@rehansaeed

can you try this way

https://codepen.io/tag/loading-screen

hi @rehansaeed

please follow the steps carefully

1. Add the following code to the head section of theme file


2. Add the following code just after the body tag


1 Like

@Ahsan_ANC it worked thanks

This worked for me, but it significantly reduced my pagespeed insights scoring?
How can I optimise this code for better performance?

Thanks

Ah, I’m going to reply to my own comment here(…)

Note to all, ensure your preloader .gif is no larger than 150x150 as this will cause very significant “Largest Contentful Paint Element” delays.

I improved my mobile speed from 44/100 to 66/100 by simply resizing my .gif :slightly_smiling_face:
Desktop is at 91/100 so that’s great…

Thanks