How to not load lottie on the Mobile View

I did put a display: none on the lottie animation, but on the background it’s still being loaded. How to stop lottie from loading on mobile devices because it makes the page slower on mobile.

You might have to use a bit of custom code

We recently found a fix to this. Please see this post for help:

Has anyone managed to find an alternate solution to this? We tried @FDRon’s solution but not sure what class name to apply - tried the body class name we have and it caused a major error in Lighthouse and in general.

We also tried to use the class name for the div that holds the lottie file we want removed but no success, lighthouse still shows it loading. Pretty much out of ideas on this one!