Hello, I have a text that appears in the middle of the screen while hovering an image.
The problem is that since the text block is inside the image div block, the hover still happening and consequently showing the text even when I’m out of the image.
How to experience this problem: mouse hover the image and quit the image keeping the mouse over the text and you will see what I mean.
I would like to quit the text as soon as I leave the image mouse hover.
I’ve tried to place this text div outside the image div and some bugs happened.
Hey @joejola, yes.
Did you try to leave the image keeping the mouse over the text that appears? That is the actual problem.
If you leave the image keeping the mouse out of the text, it works.
Hello @Eli11 thanks for this.
I did exactly what you did and almost worked properly.
The only thing that went wrong was that the text is appearing behind the image.
You set the hover text with z-index:1 and the hover trigger with z-index:2. I don’t understand why your text is appearing properly over the image if the image has a higher z-index value.
If I change the z-index, the animation doesn’t work anymore.
There’s 3 elements to it. One parent div (with the background image), and 2 children divs, one is the trigger, and the other is the text.
The parent has a set size, has its background image set.
The text div is set to position fixed and z-index 1 (display flex to show the text centered).
The trigger div has a set height and width of 100% and z-index 2, so its above the text div.
Now set the interaction to the trigger. This should work.
Hello @Eli11, is there any reason for not using an image element for the hover trigger?
I see you are setting the image as a background for the parent div. If I do that, it works.
But I would like to have a separate div block with the image so I can have more freedom to play with the image.
The idea is to have the trigger set higher (z-index) than the popup text, so you should have control over it when the popup is open.
If you will put the image in the trigger div layer, it will show on top of the popup text.
Hello @Eli11, I just came across a different problem that you might be able to help me.
I created an interaction related to other elements on my website and this interaction seems to be affecting the mouse hover behavior we setup.
First, you hover the mouse over the images and everything works well. Now, click on ‘About’ on the navbar and then back to the home clicking on ‘Back to home’, after this, the mouse hover interaction doesn’t work properly anymore. They’re not fixed while scrolling and are not respecting the position properties anymore.
I’m not sure why this is happening but it seems to be something related to the animation where I move the whole website div to the bottom when I click on ‘About’. I tried different changes and setups, but without any success.