Z-index problem

Hello :slight_smile:

I wrote a little script that allow me to pause / play an HTML5 video on mouse over.
On top of that HTML5 video, I have set up a div with absolute position to act as an overlay link.
The play / pause behaviour works perfectely well on chrome but the overlay link does not work.

On the other hand, on safari and firefox, the play / pause behaviour does not work but the link works… I believe there is a z-index issue but can’t figure out what I’m doing wrong.

Here is the screenrecording of the issue on chrome / safari:

Would someone have time to have a quick look at my simplified read-only link ?
https://preview.webflow.com/preview/html5-bf256a?utm_source=html5-bf256a&preview=9d6f6384bd6ef601a638d39db5b81bb0

@webdev maybe ? :blush:

Hi @anthonysalamin, I have a suggestion, try giving video a z-index of 0 and position relative:

and then give overlay z-index of 1:

I hope that helps.

Hi @cyberdave !

Thank you for getting back at me, appreciate !
It does help as the link is now clickable on all browsers.
However, the play/pause behaviour does not work neither on Chrome nor Firefox/Safari.

I tried to replicate the Webflow structure on Codepen:
https://codepen.io/anthonysalamin/pen/xevPgM

… unfortunately strugelling to get it work on firefox/safari, not sure why :thinking:

Best,
Anthony

Hi again :slight_smile:

I have re-worked the HTML structure and javacript to now target the parent element containing the video markup in addition to your z-index suggestion.

It now works on Chrome and Firefox, but still no luck with Safari.
I can’t figure out what it is that Safari does not like in my snipet.

Here is a little screen recording:

Here is my latest codepen
https://codepen.io/anthonysalamin/pen/RmPgxe

Here is my over simplified read-only webflow link
https://preview.webflow.com/preview/video5?utm_source=video5&preview=9d6f6384bd6ef601a638d39db5b81bb0

Maybe someone would like to have a look ?
Would be much appreciated :slight_smile:

EDIT:
Again, the expected behaviour is quite simple:
Have an autoplay HTML5 video, when the user mouse over the video > the video pauses, when he mouse out > the video plays again. The parent element of the video is listening to the hover event and triggers the pause() or play() function.

Thank you,
Anthony