Can I limit my preloading screen to appear only during specific actions?

I have coding for a preloading screen that shows up every time something is clicked on the site. Is it possible to have it where it only shows when either 1) a link in the hamburger menu is clicked, or 2) only when first coming to home page on site & when the home button / logo is clicked. This is the code I currently have running. My site link is ysamani.com.


    

      
![darker.png?v=1676571597|2000x2000](upload://qcAi7fbw2jMZ9Am2wneGIkLKEXI.jpeg)

    

 

Thanks for any help and insight given.

Hi @ddai

Would you like to show loading on homepage? Don’t need show other pages?

Correct!

Hi,

Maybe I suggest code below:

{% if template == 'index' %}
    
	    

	      
![darker.png?v=1676571597|2000x2000](upload://qcAi7fbw2jMZ9Am2wneGIkLKEXI.jpeg)

	    

	

	

	

	
{%  endif  %}

That works!! Sorry to bother, is it possible to have this preload screen when clicking any button in the hamburger menu as well as when you click the cart button?

Hi @ddai

You can use code below:

{% if template == 'index' or  template contains 'collection' or template contains 'blog' or template contains 'page' or template contains 'article' or template contains 'cart' %}
    
	    

	      
![darker.png?v=1676571597|2000x2000](upload://qcAi7fbw2jMZ9Am2wneGIkLKEXI.jpeg)

	    

	

	

	

	
{%  endif  %}

I applied your coding and I am getting this. Also, it is the same as before, where the popup only shows when going to homepage. Am I to replace my whole code with your whole code? As that is what I did.

Hey I was wondering if you ever got this fixed and where did you place the code? Im trying to set up a preloader the one I had wasn’t showing on mobile