Bored with the same old Hero design? You might want to try creating a design that can change the Hero background on hover in Elementor, which will be covered in this tutorial.
By the way, Hero here does not refer to a real-life hero, but rather the large, eye-catching section at the top of a webpage that often features prominent visual elements like images, videos, or animations. For an example of what it looks like when finished, see below.
How is it? Do you understand what it means? If so, let us proceed to the steps for creating a Hero like the example above.
How to Change Hero Background on Hover in Elementor
Before starting, make sure the following plugins are installed on your website:
- Elementor Pro, or
- Elementor Free + Royal Elementor
- 4 different background images
In this tutorial, we will use Elementor Free and Royal Elementor, so you can try it without needing Elementor Pro.
1. Create a Container
Once you are on the page being edited with Elementor, create a new Container with the following settings:
- Content Width: Full Width
- Width: 100%
- Min-Height: 100vh
- Padding: 0px
Also, make sure to add the class main-container-slide to that container from the Advanced
tab.
Still in the same container and on the Advanced tab, add Custom CSS from the Custom CSS menu for Elementor Pro, or Custom CSS – Royal Addons for Elementor Free + Royal Elementor.
.main-container-slide [class*="slide"]:hover { background-color: #CE3A3AA1 !important;}.main-container-slide:has(.slide1:hover) { background-image: url(https://staging.wpgan.com/gambar1.jpg) !important;}
.main-container-slide:has(.slide2:hover) { background-image: url(https://staging.wpgan.com/gambar2.jpg) !important;}
.main-container-slide:has(.slide3:hover) { background-image: url(https://staging.wpgan.com/gambar3.jpg) !important;}
.main-container-slide:has(.slide4:hover) { background-image: url(https://staging.wpgan.com/gambar4.jpg) !important;}Replace https://staging.wpgan.com/gambar1.jpg, gambar2.jpg, gambar3.jpg, and gambar4.jpg with the background URLs you will use. You can ignore any error messages or notifications on each line.
3. Customize the Main Container Style
Still in the same container, open the Style tab and configure it as follows:
- Background: Normal
- Background Type: Classic
- Color: Transparent
- Image: *Select the main image you will use when not hovering
- Image size: Full
- Position: Center Center
- Repeat: No-repeat
- Display Size: Cover
4. Create a New Container
Now you can add a new container inside the existing container with this configuration:
- Content Width: Full Width
- Width: 25%
Also, make sure to add the Class named slide1 to the new container from the Advanced
tab.
5. Duplicate the New Container Now you can duplicate the new container by clicking on the container and pressingCTRL + D , or by right-clicking and selecting the Duplicate
option until there are 4 containers. Then, update the Class for each container to slide1, slide2, slide3, and slide4.
6. Add Content to Each Container
You can add any content to each container as needed and perform other customizations like Background Overlay. For the example in this tutorial, the container content looks like this.
7. Check the Results and Publish
Now you can try hovering over each container, and the background will change like this.
If it works, you can add other content or publish the page you have created immediately.
COMMENTS
Loading...