Created
July 31, 2017 16:57
-
-
Save timersys/d3cde5a27e9f2ae4ac83d5c619e6ebfa to your computer and use it in GitHub Desktop.
Videos on Popups plugin
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
/** | |
* Snippet for WordPress popup plugin | |
* https://wordpress.org/plugins/popups/ | |
* Add this in your theme javascript files | |
*/ | |
/** | |
* How to pause videos when popup is closed | |
* Replace 123 with your popup id | |
*/ | |
jQuery(document).on('spu.box_close',function(e,id){ | |
if( id == '123' ) { | |
$('#spu-123').remove(); // this will destroy popup entirely | |
// $('#video-id').remove(); // or you can target your video container and leave popup intact | |
} | |
}); | |
/** | |
* How to play video when popup is open | |
* Replace 123 with your popup id | |
*/ | |
jQuery(document).on('spu.box_open',function(e,id){ | |
if( id == '123' ) { | |
$('#spu-123 .spu-box-content').html('<iframe src="video_url"></iframe>'); // try loading the video iframe once the popup is opened | |
// Or use youtube api as described in https://gist.github.com/timersys/99db1a8d2c8db74cb954 | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment