Hi, I would like that when I hover the mouse pointer over a word, an image would appear in the box on the left of my site, as seen in the example attached.
Is there any way to do it?
Thanks!
I’m certainly no expert in this field, but I know it can be done with velo.
You’d be using onMouseIn() over each word and (the quick and dirty way) hiding/unhiding an image. I guess if you wanted to do it properly, you could set up a gallery and call each image.
Anywho, that’s something for the velo forum. Whether there’s a way to do it without script, I’m not sure.
Hi Andrea,
Check out this example: https://www.wix.com/velo/example/text-microinteractions
The examples shows a scenario a bit more complicated than you need (it also animates the image) but you can deduce your use case from it.
Good luck!
see $w syntax here: https://www.wix.com/velo/reference/$w/$w
if your element id is “photo” you should use $w(‘#photo’)…
$w . onReady ( function () {
// Declare all elements:
const age = $w ( ‘#age’ )
const cane = $w ( ‘#cane’ )
// Play ‘show images’ animation on hover and reverse on out:
age . onMouseIn (() => show . cane ())
age . onMouseOut (() => hide . cane ())
});
I TRY THIS ALTERNATIVE WAY, BUT STILL DOESN?T WORKS
Hi Andrea,
Use this code:
$w ( ‘#text1’ ). onMouseIn (() => {
$w ( ‘#image1’ ). show ();
})
Remember to hide the image by default so it appears only when hovering over the text.
Good luck!
Asaf
Thank you Asaf! You resolve all my problems!! thanks a lot!!!
Hi Asaf!
This is my website https://www.313-distribution.com
But there is a small problem:
when I hover the cursor over the words, nothing appears, but when I go back over the second time, then the photo appears.
Is there anything else I can do to ensure that the photos are loaded on the first mouse over?
Thanks!
Hi Andrea,
I see you don’t have a onReady function on your page. Please define the event handlers in the onReady function. Read more about it here: https://www.wix.com/velo/reference/$w/onready
Good luck!
Hi Asaf,
is this the code?
I try a lot of different solution, but doesn’t works…
Can you help me with an example, please?
// Code you want to run when the page loads
$w.onReady(function () {
console.log(`Device viewing site is: ${wixWindow.formFactor}`);