Issue with BG VIDEO (custom code)

Hello guys !

I used a custom code to play BG VIDEO on hover :

 <script>
var Webflow = Webflow || [];
Webflow.push(function() {
var figure = $(".video").hover(function() {
$('video', this).get(0).play();
}, function() {
$('video', this).get(0).pause();
}).each(function() {
$('video', this).get(0).pause();
});
});
</script>

Do you know how can I DISABLE IT on mobile ?

Thanks in advance !

Max

A nocode solution:

Duplicate your .video element and duplicate its class into a different class (.videomobile).

Hide the .video element on mobile.
Hide the .videomobile element on desktop.

It won’t do an extra load on the site as the resource called is the same.

Merci beaucoup ! :slight_smile: