Book via WhatsApp// Force correct autoplay attributes on all Elementor background videos
document.addEventListener('DOMContentLoaded', function() {
// Target Elementor's background video elements
var videos = document.querySelectorAll(
'.elementor-background-video-hosted, ' +
'.elementor-background-video-container video, ' +
'video.elementor-video'
);
videos.forEach(function(video) {
video.setAttribute('playsinline', '');
video.setAttribute('muted', '');
video.muted = true; // some browsers need the property, not just attribute
video.setAttribute('autoplay', '');
video.setAttribute('loop', '');
video.setAttribute('preload', 'auto');
// Force play attempt (catches cases where autoplay was blocked)
var playPromise = video.play();
if (playPromise !== undefined) {
playPromise.catch(function() {
// Autoplay was prevented — try again on first user interaction
document.body.addEventListener('touchstart', function() {
video.play();
}, { once: true });
});
}
});
});