danieliser
9/16/2015 - 2:18 AM

autoplay-on-open.php

<?php

add_action('wp_footer', 'my_custom_popup_scripts', 500 );
function my_custom_popup_scripts() { ?>
	<script type="text/javascript">
	jQuery('#popmake-123')
		.on('popmakeBeforeOpen', function () {
			var $iframe = jQuery('iframe', jQuery(this)),
				src = $iframe.prop('src');
			$iframe.prop('src', '').prop('src', src + '/?autoplay=1');
		})
		.on('popmakeBeforeClose', function () {
			var $iframe = jQuery('iframe', jQuery(this)),
				src = $iframe.prop('src');
			$iframe.prop('src', '').prop('src', src.replace('/?autoplay=1', ''));
		});
	</script><?php
}