HTML5 video play/pause on hover
-
Hi Armin,
I would like to play/pause HTML5 videos on hover instead of on click. I tried to go through the JS code to change it but I couldn't figure it out. How can I do that?
Thanks :)
-
Hey leednl!
You can use this custom JS in "lay options" -> "custom html/css" -> "Custom <head> content"
<script> window.laytheme.on("newpageshown", function(){ jQuery('video').each(function(){ this.pause(); }); jQuery('video').on('mouseenter', function(){ this.play(); }); jQuery('video').on('mouseleave', function(){ this.pause(); }); }); </script>
To make this work you need to check "autoplay" for all of your html5 videos in the gridder.
-
Thank you so much!
-
Trying the same, but it seems it doesnt work anymore. Should I do sth different?
I'm trying to use linked html5 videos in gridder.
I don't answer or check forum DMs, please just post on the forum.
Try this to fix issues before you post:
Use the Search Feature. Maybe there is already a solution to your issue.
1. Update Lay Theme and all Lay Theme Addons
2. Disable all Plugins
3. Go to Lay Options → Custom CSS & HTML, click "Turn Off All Custom Code ", click "Save Changes"
4. Now see if your problem solved itself
5. Go here, see if your problem is listed here:
Troubleshooting
When you post:
1. Post a link to where the problem is
2. If the problem is difficult to explain, post screenshots / link to a video to explain it