Hey everyone, I'm wondering how to change a data attribute in my code. For example, I am currently using a script for a video background, but I want to replace the video with a lighter version when viewed on a mobile device. In my JavaScript file, I have included the following:
/* Include your own JavaScript code here */
$(document).ready(function(){
if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|OperaMini/i.test(navigator.userAgent) ) {
$('.fullscreen').attr('data-vide-bg', 'homepages/portfolio/video/mobile');
}
});
In my index.html file, I have the following setup for the background video:
<section class="fullscreen" data-video-bg="homepages/portfolio/video/merge-kqwil">
<section>
What I would like to achieve is to replace the background video with
"homepages/portfolio/video/mobile"
instead of homepages/portfolio/video/merge-kqwil
when a mobile device is detected.
I am using the VideoBg plugin for the background video, which normally displays a png or JPG when viewed on mobile devices. However, I want to customize this behavior and show the specific video for mobile instead. Any help would be appreciated. Thank you!