Black Friday 2026 50% off every plan Our biggest deal of the year on #1 Joomla products.
Ends in 2d 07h 30m 53s
Claim 50% off
Awaiting an answer SP Page Builder Joomla 6 v6.10.0

How to automatically close a modal popup when the video ends?

Asked by COTTIN Rudy 16 hours ago Last activity 2 hours ago

Hi,
I put a Modal popup in my page with a video content and I want the frame close automatically when the video ends.
How can I do that?

I tried to put the custom javascript below in template custom code section but it didn't work:

jQuery(document).on('mfpOpen', function () {
  var video = jQuery('.mfp-content video').get(0);
  if (video) {
    video.addEventListener('ended', function () {
      jQuery.magnificPopup.close();
    });
  }
});

Thanks a lot for your suggestions.

2 replies

Mehtaz Afsana Borsha Staff

Hi there,

Thank you for reaching out, and I apologize for the inconvenience. Automatically closing the Modal Popup when a video ends is not a built-in feature of the add-on and will require custom JavaScript.

Please note that our support policy does not cover custom code or feature modifications, so this implementation will need to be handled on your end. Thank you for your understanding!

-Regards.

COTTIN Rudy Asked this

Hi,
Thank you for your answer.
This option may be integrated into a future version. It would be great.

Regards.

Log in to reply.