Created
December 7, 2015 22:11
-
-
Save ericakfranz/d05f238d5f9e2dc1cebc to your computer and use it in GitHub Desktop.
Stop a video from playing when the optin closes, then add the video url back when the optin opens - useful for Manual Trigger optins.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery(document).ready( function($){ | |
//Snag the URL of the iframe so we can use it later | |
var url = $('.optin_custom_html_applied iframe').attr('src'); | |
$(document).on('OptinMonsterOnShow', function( event, data, object){ | |
//Below we remove the URL to stop the video from playing, here we add it back in | |
$('.optin_custom_html_applied iframe').attr('src', url); | |
}); | |
$(document).on('OptinMonsterOnClose', function( event, data, object){ | |
//Assign the iframe's src to null, which kills the video | |
$('.optin_custom_html_applied iframe').attr('src', ''); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment