(This page includes affiliate links. If you click and purchase, I receive a small commission at no extra cost from you and that way you can support me. I only recommend tools that I have personally used and loved.)
Required for Lottie and Global Code –
1 – Elementor Pro
OR
If you’re using free version, Install a Lottie Plugin so that it allows uploading of json file & Install WPcode snippet plugin to insert the code globally.
Recommended to get Elementor Pro as it removes the need to install 2 extra plugins.
CSS and JAVASCRIPT (JS) code to run Lottie Animation on Button/Element Click
- You can remove .sparkleElement {cursor:pointer;} to remove mouse changing to hand icon when hovered on interactable elements.
- Add you CSS customization in .sparkleAnimation, including height and width for custom size of Lottie animation.
- The z-index is set to 1 for the Lottie, so make sure your containers have higher z-index if you wish to place the animation behind.
- #ADDLOTTIEURL : Replace this to your Lottie path URL.
- Give CSS class “sparkleElement” to elements that should have Lottie Animation on click.