Shapeusto logo
25 Jun 2025
Update: 25 Jun 2025

Autoplay Video in Lazy-Loaded Breakdance Popup

Add this JS to code snippets:

document.addEventListener("DOMContentLoaded", function () {
  const button = document.getElementById("video-popup"); // ← správny ID
  const container = document.getElementById("video-container-14794");
  const modal = document.querySelector('[data-breakdance-popup-id="14794"]');
  const popupWrapper = modal ? modal.closest('.bde-popup') : null;

  if (!button || !container || !popupWrapper) return;

  const observer = new MutationObserver(function () {
    const isOpen = popupWrapper.classList.contains('breakdance-popup-open');

    if (isOpen) {
      if (!container.querySelector("video")) {
        container.innerHTML = `
          <video width="100%" controls autoplay playsinline>
            <source src="https://wordpress-1413010-5631811.cloudwaysapps.com/wp-content/uploads/2025/06/eRecruiter-Software-Demo.mp4" type="video/mp4">
            Your browser does not support the video tag.
          </video>
        `;
      }
    } else {
      container.innerHTML = ''; // voliteľné – ak chceš po zatvorení odstrániť video
    }
  });

  observer.observe(popupWrapper, { attributes: true, attributeFilter: ["class"] });

  button.addEventListener("click", function () {
    // Netreba nič, observer sa postará
  });
});

In empty popup insert empty div with ID “video-container-14794”

Matt Caine
- Founder of Shapeusto

Get it done.

Pause or cancel any time

If you don't need our services, there's no reason to pay. Just pause your subscription.

48 hour average delivery

We work incredibly fast. We can create most tasks within 48 hours.

Unlimited requests

Simply enter the number of tasks you need to solve, and we'll take care of all of them.

Unlimited users

An unlimited number of team members can add tasks to us.
Pause or cancel anytime

Pause or cancel anytime

If you don't need our services, there's no reason to pay. Just pause your subscription.
48 hour average delivery

48 hour average delivery

We work incredibly fast. We can create most tasks within 48 hours.
Unlimited users

Unlimited users

An unlimited number of team members can add tasks to us.
Unlimited requests

Unlimited requests

Simply enter the number of tasks you need to solve, and we'll take care of all of them.