- Posts: 67
- Thank you received: 0
Hover pics
-
andre6
Active member - Topic Author
- Member
Less
More
1 year 4 months ago #50579
by andre6
Hover pics was created by andre6
I would like to edit a photo with a hover. that if I hover over it with the mouse, a different image will appear.
How can I create that with the PageBuilder?
How can I create that with the PageBuilder?
Please Log in to join the conversation.
-
milos
Support Staff - Moderator
Less
More
- Posts: 6730
- Thank you received: 712
1 year 4 months ago #50582
by milos
Replied by milos on topic Hover pics
Hello,
This is not possible from the page builder. Also, even if it sounds easy, it's not, because if you code this only from CSS, the effect will not work perfectly. You must add some Javascript that preloads both images (original and hover) so the effect works smoothly.
The easiest way is to add a Code block and insert this code:
You must preload the myimage2.png by adding this code in Head (you can add this from the template options, under the Custom tab):
Change the URLs of the images to the correct ones and also your website URL.
Regards,
Milos
This is not possible from the page builder. Also, even if it sounds easy, it's not, because if you code this only from CSS, the effect will not work perfectly. You must add some Javascript that preloads both images (original and hover) so the effect works smoothly.
The easiest way is to add a Code block and insert this code:
Code:
<img src='images/myimage.png' onmouseover="this.src='images/myimage2.png';" onmouseout="this.src='images/myimage.png';" />
You must preload the myimage2.png by adding this code in Head (you can add this from the template options, under the Custom tab):
Code:
<link rel="preload" as="image" href="https://www.yourwebsite.com/images/myimage2.png" />
Change the URLs of the images to the correct ones and also your website URL.
Regards,
Milos
Please Log in to join the conversation.
Time to create page: 0.205 seconds