Stop Video When the Popup Closes

If you are not already familiar with using custom JavaScript, check out our getting started guide.

The following describes how to stop videos when the popup closes.

YouTube

jQuery('#pum-123')
    .on('pumBeforeClose', function () {
        var $iframe = jQuery('iframe', jQuery(this)),
            src = $iframe.prop('src');
        $iframe.prop('src', '').prop('src', src.replace('?autoplay=1', ''));
    });

View the source on GitHub.

Vimeo

jQuery('#pum-123')
    .on('pumBeforeClose', function () {
        var $iframe = jQuery('iframe', jQuery(this)),
            src = $iframe.prop('src');
        $iframe.prop('src', '').prop('src', src.replace('&autoplay=1', ''));
    });

View the source on GitHub.

HTML5

jQuery('#pum-123')
    .on('pumBeforeClose', function () {
        var $video = jQuery('video', jQuery(this));
        $video[0].pause();
    });

View the source on GitHub.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.