Credit for the base code goes to Maxime Desrosiers at Element.How >> here <<
Also, this tutorial assumes you have a basic understanding of Elementor Pro and its widgets and containers.
Elementor comes with a fantastic Preloader feature that works on every page of your WordPress site, but what if you want something fancy just on the Homepage? Or a Landing Page? Maybe your site logo and tagline, before the screen fades into your beautiful website?
See an example of this >> here <<.
The code Maxime has generously given to us was perfect right out of the box, but I wanted to use an image and text, rather than an animated GIF. I do love editing in Adobe Suite, but I really just wanted to be able to replace the image and text wherever I like, so I came up with the following.
- Start by adding the HTML Widget to the top of your page.
- Next add the below code. It uses the vanilla-preloader class with two new divs in between for the logo that fades in and out, and then the text that fades in and out.
- You must add your image between the quotations that read YOUR IMAGE HERE.
WE LOVE RABBITS!
- Next add the following CSS underneath the previous code.
- In this section you can change the font family and adjust the size and color. I also added the @media parameters to change the font size on smaller mobile devices.
- The keyframes control the background animation. Mine lasts 8 seconds.
- Now we add the Javascript underneath the CSS that controls the text and image fade.
If you run into issues, you might want to check which plugins are interfering, or if javascript or jquery in another area of the page is interfering.